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

            Bug ID: 127376
           Summary: boostrap-lto fails with a compare error
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---

On

 - aarch64-none-linux-gnu
 - arm-none-linux-gnueabihf
 - x86_64-pc-linux-gnu

configured with --enable-checking=yes,rtl,extra
--with-build-config=bootstrap-lto

always ends in stage2 vs stage3 comparison failures

15:36:29   mpfr/src/urandom.o differs
15:36:29   mpfr/src/urandomb.o differs
15:36:29   mpfr/src/vasprintf.o differs
15:36:29   mpfr/src/yn.o differs
15:36:29   mpfr/src/zeta.o differs
15:36:29   mpfr/src/zeta_ui.o differs

of pretty much every object file.

This is because in Makefile.tpl +579 we have

STAGE1_TFLAGS += -fno-checking
STAGE2_CFLAGS += -fno-checking
STAGE2_TFLAGS += -fno-checking
STAGE3_CFLAGS += -fchecking=1
STAGE3_TFLAGS += -fchecking=1

But with a LTO bootstrap the options leak into the LTO metadata.

during an LTO bootstrap we call compare-lto which strips the options from
.gnu.lto_.opts but they're also present in .gnu.lto_.decls.*.

So we get a miscompare due to -fchecking differences.

I guess stripping options could be dangerous for .gnu.lto_.decls.*, so not sure
what the correct fix is here.  one option is to force LTO bootstraps to have a
non-checking stage3? or a checked stage1 and 2?

Reply via email to