bug-m4
[Top][All Lists]
Advanced

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

Re: M4 tests fail when built with PGI compilers


From: Paul Eggert
Subject: Re: M4 tests fail when built with PGI compilers
Date: Wed, 8 Feb 2017 16:19:21 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/06/2017 01:37 PM, Stewart, Adam James wrote:
I tried applying your patch, and it looks like I got a bit further along, but 
`make check` still crashes with:

   CC       test-stddef.o
PGC-S-0045-Illegal field size 
(/blues/gpfs/home/software/spack-0.10.0/var/spack/stage/m4-1.4.18-zwtcbe4z66lx36aq7iuwsqbmz35a76jp/m4-1.4.18/tests/test-stddef.c:
 45)
PGC-S-0045-Illegal field size 
(/blues/gpfs/home/software/spack-0.10.0/var/spack/stage/m4-1.4.18-zwtcbe4z66lx36aq7iuwsqbmz35a76jp/m4-1.4.18/tests/test-stddef.c:
 46)
PGC/x86-64 Linux 16.5-0: compilation completed with severe errors
make[5]: *** [test-stddef.o] Error 2

Lines 45 and 46 of test-stddef.c look like:

       /* Solaris 10 has a bug where offsetof is under-parenthesized, and
       cannot be used as an arbitrary expression.  However, since it is
       unlikely to bite real code, we ignore that short-coming.  */
        /* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */
45   verify (sizeof (offsetof (struct d, e)) == sizeof (size_t));
46   verify (offsetof (struct d, e) < -1); /* Must be unsigned.  */
        verify (offsetof (struct d, f) == 1);

Is this expected?

No, possibly it's a bug in pgcc, possibly it's a Gnulib bug, or maybe it's just that Gnulib should work around the pgcc bug. It's hard to tell from these symptoms. To figure it out, you might try doing this:

  cd tests && rm test-stddef.o && make V=1 test-stddef.o

This will output some long command like this:

source='../../m4-1.4.18/tests/test-stddef.c' object='test-stddef.o' libtool=no \
DEPDIR=.deps depmode=pgcc /bin/sh ../../m4-1.4.18/build-aux/depcomp \
pgcc -DEXEEXT=\"\" -I. -I../../m4-1.4.18/tests -I../lib -DIN_M4_GNULIB_TESTS=1 -I. -I../../m4-1.4.18/tests -I.. -I../../m4-1.4.18/tests/.. -I../lib -I../../m4-1.4.18/tests/../lib -g -c -o test-stddef.o ../../m4-1.4.18/tests/test-stddef.c

Change the "-g -c -o test-stddef.o" to "-E" and collect the output into a file t.i, like this:

pgcc -DEXEEXT=\"\" -I. -I../../m4-1.4.18/tests -I../lib -DIN_M4_GNULIB_TESTS=1 -I. -I../../m4-1.4.18/tests -I.. -I../../m4-1.4.18/tests/.. -I../lib -I../../m4-1.4.18/tests/../lib -E ../../m4-1.4.18/tests/test-stddef.c >t.i

Then look in t.i for the first line after the declaration of struct d. On my platform the line looks like this:

extern int ( * _gl_verify_function45 ( void ) ) [ ( ! ! sizeof ( struct { unsigned int _gl_verify_error_if_negative : ( sizeof ( ( ( unsigned long ) ( & ( ( ( struct d * ) 0 ) -> e ) ) ) ) == sizeof ( size_t ) ) ? 1 : - 1 ; } ) ) ] ;

If it looks different, figure out why. If not, try compiling this test case with pgcc -c:

  #include <stddef.h>
  struct d { char e; char f; };

  extern int (*g (void))
  [(!!sizeof (struct { unsigned int h :
(sizeof (offsetof (struct d, e)) == sizeof (size_t)) ? 1 : -1; }))];

This is valid C code, and if pgcc rejects it you have a simple case illustrating a pgcc compiler bug.

I notice you're running pgcc 16.5. For what it's worth I do not observe the problem with pgcc 16.10 (x86-64 GNU/Linux). So maybe it's a pgcc bug that is already fixed in later versions.




reply via email to

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