Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643806 - sys-devel/gcc-7.2.0 : cc1: internal compiler error: in fail, at selftest.c:46 (USE=debug)
Summary: sys-devel/gcc-7.2.0 : cc1: internal compiler error: in fail, at selftest.c:46...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-07 16:42 UTC by Toralf Förster
Modified: 2020-04-25 10:59 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,14.58 KB, text/plain)
2018-01-07 16:42 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,872 bytes, text/plain)
2018-01-07 16:42 UTC, Toralf Förster
Details
environment (environment,158.00 KB, text/plain)
2018-01-07 16:42 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,11.11 KB, application/x-bzip)
2018-01-07 16:42 UTC, Toralf Förster
Details
logs.tbz2 (logs.tbz2,50.72 KB, application/x-bzip)
2018-01-07 16:42 UTC, Toralf Förster
Details
sys-devel:gcc-7.2.0:20180107-161618.log (sys-devel:gcc-7.2.0:20180107-161618.log,908.92 KB, text/plain)
2018-01-07 16:42 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,71.37 KB, application/x-bzip)
2018-01-07 16:42 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2018-01-07 16:42:06 UTC
/var/tmp/portage/sys-devel/gcc-7.2.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-7.2.0/work/build/./gcc/ -nostdinc -x c /dev/null -S -o /dev/null -fself-test=/var/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0/gcc/testsuite/selftests
/var/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0/gcc/function-tests.c:357: verify_three_block_cfg: FAIL: ASSERT_EQ ((3), (((fun)->cfg->x_n_basic_blocks)))
cc1: internal compiler error: in fail, at selftest.c:46
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0-no-multilib-hardened_libressl-test_20180107-170619

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-6.4.0 *

Available Python interpreters, in order of preference:
  [1]   python3.5
  [2]   python2.7 (fallback)




emerge -qpv sys-devel/gcc
[ebuild   R   ] sys-devel/gcc-6.4.0  USE="cxx debug* hardened nls nptl openmp (pie) (ssp) vtv (-altivec) (-awt) -cilk -doc (-fixed-point) -fortran (-gcj) -go -graphite (-jit) (-libssp) -mpx (-multilib) -objc -objc++ -objc-gc (-pch) -pgo -regression-test (-sanitize) -vanilla"
Comment 1 Toralf Förster gentoo-dev 2018-01-07 16:42:09 UTC
Created attachment 513670 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2018-01-07 16:42:11 UTC
Created attachment 513672 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2018-01-07 16:42:14 UTC
Created attachment 513674 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2018-01-07 16:42:17 UTC
Created attachment 513676 [details]
etc.portage.tbz2
Comment 5 Toralf Förster gentoo-dev 2018-01-07 16:42:20 UTC
Created attachment 513678 [details]
logs.tbz2
Comment 6 Toralf Förster gentoo-dev 2018-01-07 16:42:23 UTC
Created attachment 513680 [details]
sys-devel:gcc-7.2.0:20180107-161618.log
Comment 7 Toralf Förster gentoo-dev 2018-01-07 16:42:26 UTC
Created attachment 513682 [details]
temp.tbz2
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-07 22:49:04 UTC
Is it easily reproducible on your side?

I tried locally with -march=native and it did not break. Can you post our output of:

$ gcc -Q -O2 --help=target     -march=native
$ gcc -Q -O2 --help=optimizers -march=native
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-07 23:16:03 UTC
(In reply to Sergei Trofimovich from comment #8)
> Is it easily reproducible on your side?
> 
> I tried locally with -march=native and it did not break. Can you post our
> output of:
> 
> $ gcc -Q -O2 --help=target     -march=native
> $ gcc -Q -O2 --help=optimizers -march=native

Ah, please disregard that. It's USE=debug! Now it crashes for me the same way.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-10 22:12:55 UTC
(In reply to Sergei Trofimovich from comment #9)
> (In reply to Sergei Trofimovich from comment #8)
> > Is it easily reproducible on your side?
> > 
> > I tried locally with -march=native and it did not break. Can you post our
> > output of:
> > 
> > $ gcc -Q -O2 --help=target     -march=native
> > $ gcc -Q -O2 --help=optimizers -march=native
> 
> Ah, please disregard that. It's USE=debug! Now it crashes for me the same
> way.

Poked a bit more: it's caused by -fstack-protector-all injected by this patch
and enabled via EXTRA_OPTS:

https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.2.0/gentoo/55_all_extra-options.patch?revision=1.1&view=markup

GCC test assumes CFG has 3 entries:

  /* Verify that we have a simple 3-block CFG: the two "fake" ones, and
     a "real" one:
       [ENTRY] -> [block2] -> [EXIT].  */

  static void
  verify_three_block_cfg (function *fun)
  {
    ASSERT_TRUE (fun->cfg != NULL);
    ASSERT_EQ (3, n_basic_blocks_for_fn (fun));

The assert fails because n_basic_blocks_for_fn (fun) is 5.
I guess it's our entry/exit stack checks.

Reassigning to hardened@ to either #ifdef out failed debug tests or do them more robust.
Comment 11 Toralf Förster gentoo-dev 2018-01-10 22:26:07 UTC
(In reply to Sergei Trofimovich from comment #10)
Which looks a little bit like the same like a recent patch for the Linux kernel (commit id 3ce120b16cc5484) :

Makefile:KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)

to overcome a boot error of Gentoo hardened linux boxes.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-25 10:59:49 UTC
This failure happes not due to gcc being built wit stack check, but due to codegen inserts stack checks by default (./configure --enable-default-ssp).

I tried to reproduce it on gcc-9 and do not observe the error. Test did not seem to have changed since. My guess it's because hardened switched from fstack-protector-all to -fstack-protector-strong by defaut.

Closing as OBSOLETE.