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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22087 in the body.
You can then email your comments to 22087 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 18:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rich Burridge <rich.burridge <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 03 Dec 2015 18:59:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rich Burridge <rich.burridge <at> oracle.com>
To: bug-coreutils <at> gnu.org
Subject: Problem with stdbuf configure test for 8.24 on Solaris with Studio C
 compiler.
Date: Thu, 3 Dec 2015 10:58:26 -0800
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"





Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 19:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Rich Burridge <rich.burridge <at> oracle.com>, 22087 <at> debbugs.gnu.org
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris
 with Studio C compiler.
Date: Thu, 3 Dec 2015 19:30:10 +0000
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?
-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?

cheers,
Pádraig





Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 19:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Rich Burridge <rich.burridge <at> oracle.com>
To: Pádraig Brady <P <at> draigbrady.com>, 22087 <at> debbugs.gnu.org
Subject: Re: 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.






Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 20:05:02 GMT) Full text and rfc822 format available.

Message #14 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Rich Burridge <rich.burridge <at> oracle.com>, Pádraig Brady
 <P <at> draigbrady.com>, 22087 <at> debbugs.gnu.org
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris
 with Studio C compiler.
Date: Thu, 3 Dec 2015 12:04:35 -0800
[Message part 1 (text/plain, inline)]
How about the attached (untested) patch instead? It should fix the 
underlying problem, and thus avoid the need for fiddling with compiler 
flags.
[t.diff (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 21:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 22087 <at> debbugs.gnu.org, Rich Burridge <rich.burridge <at> oracle.com>
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on
 Solaris with Studio C compiler.
Date: Thu, 3 Dec 2015 14:02:30 -0700
Paul Eggert wrote:
> How about the attached (untested) patch instead? It should fix the
> underlying problem, and thus avoid the need for fiddling with compiler
> flags.

> diff --git a/configure.ac b/configure.ac
> index 66c8cbe..3f546e9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -475,7 +475,8 @@ AC_LINK_IFELSE(
>      {
>        stdbuf = 1;
>      }]],[[
> -    return !(stdbuf == 1);]])
> +    if (stdbuf != 1)
> +      return 1;]])
>    ],
>    [stdbuf_supported=yes])
>  AC_MSG_RESULT([$stdbuf_supported])

Fallthrough return 0?  Or is a return 0 already defaulted?  It stood
out to me that the previous return was unconditional and without an
else or a fallthrough this is a change from the previous control flow.

  -    return !(stdbuf == 1);]])
  +    if (stdbuf != 1)
  +      return 1;
  +    return 0;]])

??

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 21:08:02 GMT) Full text and rfc822 format available.

Message #20 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Bob Proulx <bob <at> proulx.com>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 22087 <at> debbugs.gnu.org, Rich Burridge <rich.burridge <at> oracle.com>
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris
 with Studio C compiler.
Date: Thu, 3 Dec 2015 14:07:22 -0700
[Message part 1 (text/plain, inline)]
On 12/03/2015 02:02 PM, Bob Proulx wrote:
> Paul Eggert wrote:
>> How about the attached (untested) patch instead? It should fix the
>> underlying problem, and thus avoid the need for fiddling with compiler
>> flags.
> 
>> diff --git a/configure.ac b/configure.ac
>> index 66c8cbe..3f546e9 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -475,7 +475,8 @@ AC_LINK_IFELSE(
>>      {
>>        stdbuf = 1;
>>      }]],[[
>> -    return !(stdbuf == 1);]])
>> +    if (stdbuf != 1)
>> +      return 1;]])
>>    ],
>>    [stdbuf_supported=yes])
>>  AC_MSG_RESULT([$stdbuf_supported])
> 
> Fallthrough return 0?

Yes, autoconf's AC_LINK_IFELSE provides an automatic 'return 0;' after
anything you supply in your macro arguments, when it builds conftest.c.

>  Or is a return 0 already defaulted?  It stood
> out to me that the previous return was unconditional and without an
> else or a fallthrough this is a change from the previous control flow.
> 
>   -    return !(stdbuf == 1);]])
>   +    if (stdbuf != 1)
>   +      return 1;
>   +    return 0;]])

Explicitly listing 'return 0;' here would result in a doubled-up return
0 in the overall conftest.c file.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 21:09:01 GMT) Full text and rfc822 format available.

Message #23 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Rich Burridge <rich.burridge <at> oracle.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>, Pádraig Brady
 <P <at> draigbrady.com>, 22087 <at> debbugs.gnu.org
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris
 with Studio C compiler.
Date: Thu, 3 Dec 2015 13:08:37 -0800
On 12/03/2015 12:04 PM, Paul Eggert wrote:
> How about the attached (untested) patch instead? It should fix the 
> underlying problem, and thus avoid the need for fiddling with compiler 
> flags.

Yup. That works nicely too.

Thanks.





Information forwarded to bug-coreutils <at> gnu.org:
bug#22087; Package coreutils. (Thu, 03 Dec 2015 21:10:02 GMT) Full text and rfc822 format available.

Message #26 received at 22087 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: 22087 <at> debbugs.gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, Rich Burridge <rich.burridge <at> oracle.com>
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on
 Solaris with Studio C compiler.
Date: Thu, 3 Dec 2015 14:09:32 -0700
Eric Blake wrote:
> Bob Proulx wrote:
> > Or is a return 0 already defaulted?  It stood out to me that the
> > previous return was unconditional and without an else or a
> > fallthrough this is a change from the previous control flow.
> > 
> >   -    return !(stdbuf == 1);]])
> >   +    if (stdbuf != 1)
> >   +      return 1;
> >   +    return 0;]])
> 
> Explicitly listing 'return 0;' here would result in a doubled-up return
> 0 in the overall conftest.c file.

Gotcha!  That there is already a default return 0 answers my question.

Thanks,
Bob




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 03 Dec 2015 21:58:02 GMT) Full text and rfc822 format available.

Notification sent to Rich Burridge <rich.burridge <at> oracle.com>:
bug acknowledged by developer. (Thu, 03 Dec 2015 21:58:03 GMT) Full text and rfc822 format available.

Message #31 received at 22087-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Rich Burridge <rich.burridge <at> oracle.com>, Pádraig Brady
 <P <at> draigbrady.com>, 22087-done <at> debbugs.gnu.org
Subject: Re: bug#22087: Problem with stdbuf configure test for 8.24 on Solaris
 with Studio C compiler.
Date: Thu, 3 Dec 2015 13:57:45 -0800
[Message part 1 (text/plain, inline)]
On 12/03/2015 01:08 PM, Rich Burridge wrote:
> Yup. That works nicely too. 

Thanks, I noticed a similar problem in three other places (which I guess 
don't affect your platform) and so installed the attached more-general 
patch.
[0001-build-port-to-Studio-C-on-Solaris-12.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Jan 2016 12:24:04 GMT) Full text and rfc822 format available.

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.