[Bug middle-end/87836] ICE in cc1 for gcc-6.5.0 with SPARC hardware

ro at CeBiTec dot Uni-Bielefeld.DE gcc-bugzilla@gcc.gnu.org
Sat Jan 5 22:13:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87836

--- Comment #27 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #26 from Gary Mills <gary_mills at fastmail dot fm> ---
> I have no concerns about removal of gcc support for Solaris 10:  That is an

I've only mentioned it to make clear that the oldest version of Solaris
as that's going to be tested with change quite a bit once S10 support is
gone, certainly to something much newer than the snv_121 as in Illumos.

> obsolete operating system, after all.  illumos is equivalent to Solaris 11.

No, it's not: while it's certainly closer to S11 than S10, it has still
been quite a way from snv_147 (the last OpenSolaris build) to snv_175
(aka Solaris 11.0).  No need to tell me about OpenSolaris/Illumos, btw.:
I've been in the OpenSolaris Pilot from day one.

> gas is used for illumos compilers on x86.  It works on SPARC too, and avoids
> the ICE.  Unfortunately, gcc with gas can't be used to compile the SPARC
> kernel.  That's because some SPARC kernel files are written in assembler
> language.  These won't compile with gas, only with the native assembler.  It

It shouldn't be too hard to introduce make rules (or rather change cw)
to build them with as directly, even if gcc on SPARC starts using gas.
Hasn't this already been done for Illumos on x86?

Alternatively, you can always rewrite them to use gas syntax, and I
doubt that there are many as-specific constructs or directives in there:
it's low-level kernel code, after all.

> would be difficult, but not impossible, to use gcc with gas on SPARC hardware.
>
> I've just attempted to build gcc-7.3.0 on SPARC with an even more restricted
> configuration:
>
>   $
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/configure
> --without-gnu-ld --with-ld=/usr/bin/ld --without-gnu-as --with-as=/usr/bin/as
>
> The compilers are not specified on the command line but they are in the
> environment.  The compilers were identified correctly.
>
> The build got considerably farther, but ended with this error:
>
> libtool: compile: 
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/./gcc/xgcc
> -shared-libgcc
> -B/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/./gcc
> -nostdinc++
> -L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/src
> -L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/src/.libs
> -L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/libsupc++/.libs
> -B/usr/local/sparc-sun-solaris2.11/bin/ -B/usr/local/sparc-sun-solaris2.11/lib/
> -isystem /usr/local/sparc-sun-solaris2.11/include -isystem
> /usr/local/sparc-sun-solaris2.11/sys-include
> -I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/../libgcc
> -I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/sparc-sun-solaris2.11
> -I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include
> -I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++
> -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings
> -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections
> -fdata-sections -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc
>  -fPIC -DPIC -D_GLIBCXX_SHARED -o new_opa.o
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:
> In function 'void* operator new(std::size_t, std::align_val_t)':
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:103:33:
> error: 'aligned_alloc' was not declared in this scope
>    while (__builtin_expect ((p = aligned_alloc (align, sz)) == 0, false))
>                                  ^~~~~~~~~~~~~
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:103:33:
> note: suggested alternative:
> In file included from /usr/include/stdlib.h:39:0,
>                  from
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/cstdlib:75,
>                  from
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/stdlib.h:36,
>                  from
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:27:
> /usr/include/iso/stdlib_c11.h:60:14: note:   'std::aligned_alloc'
>  extern void *aligned_alloc(size_t, size_t);
>               ^~~~~~~~~~~~~
> Makefile:936: recipe for target 'new_opa.lo' failed
> make[6]: *** [new_opa.lo] Error 1
> make[6]: Leaving directory
> '/dpool/export/home/mills/Downloads/code/oi-userland-apr/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/libsupc++'
>
> There is a patch which seems to fix this error:
>
> --- gcc-7.1.0.orig/libstdc++-v3/libsupc++/new_opa.cc    2017-01-26
> 15:30:45.000000000 +0100
> +++ gcc-7.1.0/libstdc++-v3/libsupc++/new_opa.cc 2017-05-04 17:16:25.920300456
> +0200
> @@ -31,7 +31,6 @@
>  using std::new_handler;
>  using std::bad_alloc;
>
> -#if !_GLIBCXX_HAVE_ALIGNED_ALLOC
>  #if _GLIBCXX_HAVE__ALIGNED_MALLOC
>  #define aligned_alloc(al,sz) _aligned_malloc(sz,al)
>  #elif _GLIBCXX_HAVE_POSIX_MEMALIGN
> @@ -82,7 +81,6 @@
>    return aligned_ptr;
>  }
>  #endif
> -#endif
>
>  _GLIBCXX_WEAK_DEFINITION void *
>  operator new (std::size_t sz, std::align_val_t al)

This is already fixed in gcc 7.4.0.

> I can't be certain that this patch does not have unwanted side effects, but it
> seems correct.
>
> genmddeps seems to be correct now:
>
> <mills@t2000:862>$ build/sparcv7/gcc/build/genmddeps -?
> genmddeps: invalid option `-?'
>
> At least, it doesn't dump core now.  The build got well past that point.  It
> did  build xgcc this time:
>
> <mills@t2000:865>$ build/sparcv7/./gcc/xgcc -v                
> Using built-in specs.
> COLLECT_GCC=build/sparcv7/./gcc/xgcc
> Target: sparc-sun-solaris2.11
> Configured with:
> /export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/configure
> --without-gnu-ld --with-ld=/usr/bin/ld --without-gnu-as --with-as=/usr/bin/as
> Thread model: posix
> gcc version 7.3.0 (GCC)

Which suggest to let it complete and run make check afterwards, so you
can see if there are any unexpected failures.  You should fine regular
postings of Solaris 10 and 11/SPARC testresults from the gcc-7 branch
there for comparison.

So unless something unexpected comes up, I belive this PR can be closed?


More information about the Gcc-bugs mailing list