GNU bug report logs - #20031
Solaris 10: <cstdlib> doesn't declare malloc, free, exit in the global namespace

Previous Next

Package: automake;

Reported by: "dclarke <at> blastwave.org" <dclarke <at> blastwave.org>

Date: Sat, 7 Mar 2015 17:28:02 UTC

Severity: normal

Tags: confirmed

Done: Mike Frysinger <vapier <at> gentoo.org>

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 20031 in the body.
You can then email your comments to 20031 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-automake <at> gnu.org:
bug#20031; Package automake. (Sat, 07 Mar 2015 17:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "dclarke <at> blastwave.org" <dclarke <at> blastwave.org>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Sat, 07 Mar 2015 17:28:02 GMT) Full text and rfc822 format available.

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

From: "dclarke <at> blastwave.org" <dclarke <at> blastwave.org>
To: bug-automake <at> gnu.org
Subject: GNU Automake 1.15 fails on three "yacc" cxx related tests on
 Solaris 10 AMD64
Date: Sat, 7 Mar 2015 12:27:38 -0500 (EST)
[Message part 1 (text/plain, inline)]
Systems is :

tbk $ cat /etc/release
                    Oracle Solaris 10 1/13 s10x_u11wos_24a X86
  Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights
reserved.
                            Assembled 17 January 2013

tbk $ psrinfo -pv
The physical processor has 12 virtual processors (0-11)
  x86 (chipid 0x0 AuthenticAMD family 16 model 9 step 1 clock 2100 MHz)
        AMD Opteron(tm) Processor 6172
The physical processor has 12 virtual processors (12-23)
  x86 (chipid 0x1 AuthenticAMD family 16 model 9 step 1 clock 2100 MHz)
        AMD Opteron(tm) Processor 6172

Compiler tools are Oracle Studio 12.4 :

tbk $ which cc
/usr/bin/cc
tbk $ cc -V
cc: Sun C 5.13 SunOS_i386 2014/10/20


results :

============================================================================
Testsuite summary for GNU Automake 1.15
============================================================================
# TOTAL: 2639
# PASS:  2334
# SKIP:  254
# XFAIL: 48
# FAIL:  3
# XPASS: 0
# ERROR: 0
============================================================================


Specific fails :

tbk $ grep "^FAIL" ../automake-1.15_SunOS5.10_x86_64.001.check.log
FAIL: t/yacc-cxx.sh
FAIL: t/yacc-d-cxx.sh
FAIL: t/yacc-mix-c-cxx.sh


full test suite log attached


Dennis Clarke
[automake-1.15_SunOS5.10_x86_64.001_test-suite.log.gz (application/x-gzip, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#20031; Package automake. (Fri, 19 Jan 2018 12:26:01 GMT) Full text and rfc822 format available.

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

From: Mathieu Lirzin <mthl <at> gnu.org>
To: "dclarke\@blastwave.org" <dclarke <at> blastwave.org>
Cc: 20031 <at> debbugs.gnu.org
Subject: Re: bug#20031: GNU Automake 1.15 fails on three "yacc" cxx related
 tests on Solaris 10 AMD64
Date: Fri, 19 Jan 2018 13:25:42 +0100
Hello,

Those test failures are/were happening because IIUC Solaris <cstdlib>
header declares malloc, free, exit only in the std namespace [1].

"dclarke <at> blastwave.org" <dclarke <at> blastwave.org> writes:

> /opt/solarisstudio12.4/bin/CC -DPACKAGE_NAME=\"yacc-cxx\" -DPACKAGE_TARNAME=\"yacc-cxx\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"yacc-cxx\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"yacc-cxx\" -DVERSION=\"1.0\" -I.    -I/usr/local/include -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE  -dalign -erroff=%none -errtags=yes -ftrap=%none -g -xcode=pic32 -m64 -mc -xunroll=1 -xbuiltin=%none -xtarget=opteron -xdepend=no -xnolibmopt -xlinkopt=0 -xnolibmil -xregs=no%frameptr -xs -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -D_TS_ERRNO -c -o parse1.o parse1.cc
> "parse1.cc", line 1053: Error: The function "malloc" must have a prototype.
> "parse1.cc", line 1060: Error: The function "free" must have a prototype.
> "parse1.yy", line 10: Error: The function "exit" must have a prototype.
> "parse1.cc", line 1406: Error: The function "free" must have a prototype.
> 4 Error(s) detected.
> *** Error code 2
> make: Fatal error: Command failed for target `parse1.o'

The explicit inclusion of <cstdlib> instead of <stdlib.h> is made
because those tests want to ensure that the code is invalid C.

What would seem a more robust solution would be to include <stdlib.h>
instead and make the code invalid C by another mean.

Sorry for long delay.  Thanks for the report.

[1] https://docs.oracle.com/cd/E19205-01/819-5267/bkajw/index.html

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37




Information forwarded to bug-automake <at> gnu.org:
bug#20031; Package automake. (Fri, 19 Jan 2018 12:40:03 GMT) Full text and rfc822 format available.

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

From: Dennis Clarke <dclarke <at> blastwave.org>
To: Mathieu Lirzin <mthl <at> gnu.org>
Cc: 20031 <at> debbugs.gnu.org
Subject: Re: bug#20031: GNU Automake 1.15 fails on three "yacc" cxx related
 tests on Solaris 10 AMD64
Date: Fri, 19 Jan 2018 07:39:50 -0500
On 19/01/18 07:25 AM, Mathieu Lirzin wrote:
> Hello,
> 
> Those test failures are/were happening because IIUC Solaris <cstdlib>
> header declares malloc, free, exit only in the std namespace [1].
> 
> "dclarke <at> blastwave.org" <dclarke <at> blastwave.org> writes:
> 


Good day and thank you for looking at this.

I am going to get around to testing your patch for the bug#29638 as well 
as this one .. sometime today I hope.

I'll let you know what I see.

Dennis





Changed bug title to 'Solaris 10: <cstdlib> doesn't declare malloc, free, exit in the global namespace' from 'GNU Automake 1.15 fails on three "yacc" cxx related tests on Solaris 10 AMD64' Request was from Mathieu Lirzin <mthl <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 19 Jan 2018 12:41:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#20031; Package automake. (Sun, 20 Feb 2022 19:33:02 GMT) Full text and rfc822 format available.

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

From: Mike Frysinger <vapier <at> gentoo.org>
To: 20031 <at> debbugs.gnu.org
Subject: [PATCH] tests: fix yacc C++ tests with some C++ compilers
Date: Sun, 20 Feb 2022 14:32:09 -0500
Fixes automake bug https://bugs.gnu.org/20031.

The C++ standard does not require symbols be placed into the global
namespace, just in the std namespace.  The GNU implementation will
place symbols in both.  For our specific code, we don't care either.

Unfortunately, it looks like generated flex code assumes that some
stdlib.h symbols (free, malloc, exit) are in the global namespace,
even when compiling for C++.  So when we include <cstdlib> but not
<stdlib.h>, we might not get the symbols in the global namespace.

We can workaround this by including stdlib.h in these tests without
invalidating the point of the tests in general.

* t/yacc-cxx.sh: Include stdlib.h.
* t/yacc-d-cxx.sh: Likewise.
* t/yacc-mix-c-cxx.sh: Likewise.
---
 t/yacc-cxx.sh       | 3 +++
 t/yacc-d-cxx.sh     | 3 +++
 t/yacc-mix-c-cxx.sh | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/t/yacc-cxx.sh b/t/yacc-cxx.sh
index 9dd9aabf7f38..33e73cbc0837 100644
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -43,6 +43,9 @@ END
 
 cat > parse1.yy << 'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
 // Valid C++, but deliberately invalid C.
 #include <cstdio>
 #include <cstdlib>
diff --git a/t/yacc-d-cxx.sh b/t/yacc-d-cxx.sh
index ce7a9b123094..b6390a67a51d 100644
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -26,6 +26,9 @@ write_parse ()
   header=$1
   unindent <<END
     %{
+    // Include C header to provide global symbols that flex assumes.
+    // https://bugs.gnu.org/20031
+    #include <stdlib.h>
     // Valid C++, but deliberately invalid C.
     #include <cstdlib>
     #include "$header"
diff --git a/t/yacc-mix-c-cxx.sh b/t/yacc-mix-c-cxx.sh
index eb02d4cd5790..475a8e9f5588 100644
--- a/t/yacc-mix-c-cxx.sh
+++ b/t/yacc-mix-c-cxx.sh
@@ -82,6 +82,10 @@ END
 
 cat > parse.yy <<'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
+// Valid C++, but deliberately invalid C.
 #include <cstdlib>
 #include "parse.hh"
 int yylex (void) { return 0; }
-- 
2.34.1





Added tag(s) confirmed. Request was from Mike Frysinger <vapier <at> gentoo.org> to control <at> debbugs.gnu.org. (Sun, 20 Feb 2022 19:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#20031; Package automake. (Sun, 20 Feb 2022 22:26:02 GMT) Full text and rfc822 format available.

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

From: Karl Berry <karl <at> freefriends.org>
To: vapier <at> gentoo.org
Cc: 20031 <at> debbugs.gnu.org
Subject: Re: bug#20031: [PATCH] tests: fix yacc C++ tests with some C++
 compilers
Date: Sun, 20 Feb 2022 15:25:37 -0700
    We can workaround this by including stdlib.h in these tests without
    invalidating the point of the tests in general.

Seems sensible. Thanks.





bug closed, send any further explanations to 20031 <at> debbugs.gnu.org and "dclarke <at> blastwave.org" <dclarke <at> blastwave.org> Request was from Mike Frysinger <vapier <at> gentoo.org> to control <at> debbugs.gnu.org. (Thu, 24 Feb 2022 04:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Mar 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 93 days ago.

Previous Next


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