bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: porting alignof to HP-NonStop


From: Joachim Schmitz
Subject: RE: porting alignof to HP-NonStop
Date: Thu, 23 Dec 2010 16:32:29 +0100

Here's one of those CHECK macros expanded

typedef struct { char slot1; char slot2; } char_helper; extern int (* 
verify_function40 (void)) [(! !sizeof (struct { unsigned int 
verify_error_if_negative_size__: (((size_t)__INTADDR__(&(((struct { char 
__slot1; char __slot2; } *)0)->__slot2))) == 
((size_t)__INTADDR__(&(((char_helper *)0)->slot2)))) ? 1 : -1; }))]; const int 
char_slot_alignment = ((size_t)__INTADDR__(&(((struct { char __slot1; char 
__slot2; } *)0)->__slot2))); const int char_type_alignment = 
((size_t)__INTADDR__(&(((struct { char __slot1; char __slot2; } 
*)0)->__slot2)));

Seem like the bit filed it complains about starts with the 
unsigned int verify_error_if_negative_size__: ...
looks like 

(((size_t)__INTADDR__(&(((struct { char __slot1; char __slot2; } 
*)0)->__slot2))) == ((size_t)__INTADDR__(&(((char_helper *)0)->slot2)))) ? 1 : 
-1;

Goes negative (-1), because 

((size_t)__INTADDR__(&(((struct { char __slot1; char __slot2; } *)0)->__slot2)))

Is not equal to

((size_t)__INTADDR__(&(((char_helper *)0)->slot2)))

do you see why, resp. what's wrong here?

-----Original Message-----
From: Bruno Haible [mailto:address@hidden 
Sent: Thursday, December 23, 2010 1:36 PM
To: Joachim Schmitz
Cc: address@hidden
Subject: Re: porting alignof to HP-NonStop

Joachim Schmitz wrote:
> During compile of gltests:
> Something very weird errors in test-allignof.c:
> source='test-alignof.c' object='test-alignof.o' libtool=no  
> DEPDIR=.deps depmode=none /bin/sh ./../build-aux/depcomp  cc 
> -DHAVE_CONFIG_H -I.  -DGNULIB_STRICT_CHECKING=1  -I. -I.  -I.. -I./..  
> -I../gllib -I./../gllib  -I/usr/local/include  -g -Wnowarn -c -o 
> test-alignof.o test-alignof.c
>   CHECK (char)
>   ^
> "/usr/local/Floss/gnulib/testdir-posix/gltests/test-alignof.c", line 40: 
> error(197):
>           invalid size for bit field
> ...

This looks pretty weird:
alignof_slot (char) and offsetof (char_helper, slot2) should be different??
Where alignof_slot (char) is defined as
  offsetof (struct { char __slot1; char __slot2; }, __slot2) and char_helper is 
defined through
  typedef struct { char slot1; char slot2; } char_helper;

The only differences between the left-hand side and the right-hand side are the 
names of the struct fields, and the use of 'typedef'.

You need to look at the preprocessed output (cc -E) of test-alignof.c and trim 
it down to produce a minimal test case.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]