Bug 69383 - [6 Regression] r232586 breaks Firefox build
Summary: [6 Regression] r232586 breaks Firefox build
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-20 09:26 UTC by Markus Trippelsdorf
Modified: 2016-04-11 18:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-01-20 00:00:00


Attachments
unreduced testcase (93.92 KB, application/x-bzip)
2016-01-20 09:56 UTC, Markus Trippelsdorf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2016-01-20 09:26:25 UTC
With r232586 I get:

trippels@gcc2-power8 src % /home/trippels/gcc_test/usr/local/bin/c++ -o Unified_cpp_gfx_graphite2_src0.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /home/trippels/gecko-dev/config/gcc_hidden.h -DGRAPHITE2_STATIC -DPACKAGE_VERSION='"moz"' -DPACKAGE_BUGREPORT='"http://bugzilla.mozilla.org/"' -DGRAPHITE2_NFILEFACE -DGRAPHITE2_NTRACING -DGRAPHITE2_NSEGCACHE -DGRAPHITE2_CUSTOM_HEADER='"MozGrMalloc.h"' -DMOZ_GLUE_IN_PROGRAM -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/home/trippels/gecko-dev/gfx/graphite2/src -I.  -I../../../dist/include   -I/usr/include/nspr4 -I/home/trippels/moz-build-dir/dist/include/nss    -I/usr/include/pixman-1    -fPIC   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MP -MF .deps/Unified_cpp_gfx_graphite2_src0.o.pp  -Wall -Wempty-body -Woverloaded-virtual -Wsign-compare -Wwrite-strings -Werror=endif-labels -Werror=int-to-pointer-cast -Werror=missing-braces -Werror=pointer-arith -Werror=return-type -Werror=sequence-point -Werror=unused-label -Werror=trigraphs -Werror=type-limits -Wno-invalid-offsetof -Wcast-align -std=c++1z -w -flto=60 --param lto-partitions=60 -ffunction-sections -fdata-sections -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe  -DNDEBUG -DTRIMMED -O3 -fomit-frame-pointer     /home/trippels/moz-build-dir/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp
In file included from ../../../dist/system_wrappers/stdlib.h:3:0,
                 from ../../../dist/include/mozilla/mozalloc.h:15,
                 from ../../../dist/stl_wrappers/cstdlib:39,
                 from /home/trippels/gecko-dev/gfx/graphite2/src/inc/Main.h:29,
                 from /home/trippels/gecko-dev/gfx/graphite2/src/Bidi.cpp:27,
                 from /home/trippels/moz-build-dir/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp:2:
/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:37:12: error: ‘std::abort’ has not been declared
 using std::abort;
            ^~~~~

/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:38:12: error: ‘std::atexit’ has not been declared
 using std::atexit;
            ^~~~~~

/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:39:12: error: ‘std::exit’ has not been declared
 using std::exit;
            ^~~~
...

trippels@gcc2-power8 tmp % cat foo.cpp
#include <stdlib.h>

trippels@gcc2-power8 tmp % cat stdlib.h
#include_next <stdlib.h>

trippels@gcc2-power8 tmp % cat cstdlib
#include <stdlib.h>

trippels@gcc2-power8 tmp % g++ -c -I./ foo.cpp
In file included from ./stdlib.h:1:0,
                 from foo.cpp:1:
/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:37:12: error: ‘std::abort’ has not been declared
 using std::abort;
            ^~~~~

/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:38:12: error: ‘std::atexit’ has not been declared
 using std::atexit;
            ^~~~~~

/home/trippels/gcc_test/usr/local/include/c++/6.0.0/stdlib.h:39:12: error: ‘std::exit’ has not been declared
 using std::exit;
            ^~~~
Comment 1 Jakub Jelinek 2016-01-20 09:41:49 UTC
If firefox provides its own wrappers of system headers, then it is responsible for making it work with the system headers.  The question is how many packages do something like that and will need fixing.
Comment 2 Jakub Jelinek 2016-01-20 09:47:15 UTC
Firefox could use
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
instead of just
#include_next <stdlib.h>
to get the old behavior I guess.
Comment 3 Jonathan Wakely 2016-01-20 09:52:28 UTC
Please provide preprocessed source so I can see what silliness Firefox does this time, but basically this is undefined behaviour:

In file included from ../../../dist/system_wrappers/stdlib.h:3:0,
                 from ../../../dist/include/mozilla/mozalloc.h:15,
                 from ../../../dist/stl_wrappers/cstdlib:39,

I'm not going to hold off fixing bugs in the real standard library because of projects that have their own fake standard library with undefined behaviour.
Comment 4 Markus Trippelsdorf 2016-01-20 09:56:20 UTC
Created attachment 37404 [details]
unreduced testcase
Comment 5 Markus Trippelsdorf 2016-01-20 10:13:45 UTC
invalid
Comment 6 Jonathan Wakely 2016-01-20 10:26:03 UTC
(In reply to Jakub Jelinek from comment #2)
> Firefox could use
> #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
> #include_next <stdlib.h>
> #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
> instead of just
> #include_next <stdlib.h>
> to get the old behavior I guess.

That would mean they don't get a non-conforming <stdlib.h> because they would circumvent the fix for PR60401, but I doubt non-conformance will worry them. It might be the simplest hack to compile again, although I wouldn't call it a fix.