GNU bug report logs - #22087
Problem with stdbuf configure test for 8.24 on Solaris with Studio C compiler.

Previous Next

Package: coreutils;

Reported by: Rich Burridge <rich.burridge <at> oracle.com>

Date: Thu, 3 Dec 2015 18:59:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Rich Burridge <rich.burridge <at> oracle.com>
To: Pádraig Brady <P <at> draigbrady.com>, 22087 <at> debbugs.gnu.org
Subject: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris with Studio C compiler.
Date: Thu, 3 Dec 2015 11:42:59 -0800
On 12/03/2015 11:30 AM, Pádraig Brady wrote:
> On 03/12/15 18:58, Rich Burridge wrote:
>> Hi,
>>
>> I'm finally getting around to integrating coreutils version 8.24
>> into Solaris 12 (and being built with the Studio C compiler rather
>> than gcc) and noticed that the test for whether we had stdbuf was
>> failing.
>>
>> I've fixed it with the following patch. Looks like gcc just doesn't
>> trip over this, but hopefully the suggested change "just works" for
>> both compilers.
>>
>> Thanks.
>>
>>
>>
>> $ cat configure.ac.patch
>> The configure test for "whether this is system supports stdbuf" was
>> failing because the warning:
>>
>> "conftest.c", line 731: warning: statement not reached
>>
>> was being turned into an error with the Studio C compiler (ignored
>> with the GNU C compiler).
>>
>> We want to adjust the -errwarn option so that it ignores
>> E_STATEMENT_NOT_REACHED errors.
>>
>> --- configure.ac.orig   2015-12-03 09:46:42.381111611 -0800
>> +++ configure.ac        2015-12-03 10:27:48.938546667 -0800
>> @@ -459,7 +459,7 @@
>>    ac_save_LDFLAGS=$LDFLAGS
>>    # Detect warnings about ignored "constructor" attributes.
>>    gl_WARN_ADD([-Werror], [CFLAGS])
>> -gl_WARN_ADD([-errwarn], [CFLAGS])
>> +gl_WARN_ADD([-errwarn=no%E_STATEMENT_NOT_REACHED], [CFLAGS])
>>    # Put this message here, after gl_WARN_ADD's chatter.
>>    AC_MSG_CHECKING([whether this system supports stdbuf])
>>    CFLAGS="-fPIC $CFLAGS"
> which statement isn't reached?
> I presume it's a false positive from the compiler?

I isolated it into the following small conftest.c program:

  1     static int stdbuf = 0;
  2
  3     void __attribute__ ((constructor))
  4     stdbuf_init (void)
  5     {
  6       stdbuf = 1;
  7     }
  8 int
  9 main ()
 10 {
 11
 12     return !(stdbuf == 1);
 13   ;
 14   return 0;
 15 }
 16


and that fails with:

$ cc -o conftest -errwarn conftest.c
"conftest.c", line 14: statement not reached
cc: acomp failed for conftest.c

> -errwarn was added to support AIX:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20733#112
> I'm worried that we may break that.
> Would it still work for you to add in addition? I.E.
>
> +gl_WARN_ADD([-errwarn=no%E_STATEMENT_NOT_REACHED], [CFLAGS])
>
> in addition to the existing -errwarn?

Yes, that works nicely. My patch is now:

--- configure.ac.orig   2015-12-03 09:46:42.381111611 -0800
+++ configure.ac        2015-12-03 11:38:42.733910645 -0800
@@ -460,6 +460,7 @@
 # Detect warnings about ignored "constructor" attributes.
 gl_WARN_ADD([-Werror], [CFLAGS])
 gl_WARN_ADD([-errwarn], [CFLAGS])
+gl_WARN_ADD([-errwarn=no%E_STATEMENT_NOT_REACHED], [CFLAGS])
 # Put this message here, after gl_WARN_ADD's chatter.
 AC_MSG_CHECKING([whether this system supports stdbuf])
 CFLAGS="-fPIC $CFLAGS"


Thanks.






This bug report was last modified 9 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.