Subject: bug#29464: gcc-7 breaks guile-2.2.2?

From: Rob Browning <[email-masked]>
Date: Thu, 28 Dec 2017 18:09:51 -0600

Dan Kegel <[email-masked]> writes:

> Building guile-2.2.2 seems fine on Ubuntu 17.04, but fails with
>
> Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
> FAIL: test-out-of-memory
> ==================================
> 1 of 39 tests failed
> Please report to [email-masked]

I also see this with 2.2.3, and assuming it's the same issue, I think
I've figured out one thing that reliably triggers it:

  CFLAGS=...-fstack-protector-strong

By default in Debian we build using the dpkg-buildpackage flags with a
(possibly vestigial) -O0 override on amd64, i.e. we have:

  $ DEB_CFLAGS_MAINT_APPEND=-O0 dpkg-buildflags
  CFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong -Wformat -Werror=format-security -O0
  CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
  CXXFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong -Wformat -Werror=format-security
  FCFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong
  FFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong
  GCJFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong
  LDFLAGS=-Wl,-z,relro
  OBJCFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong -Wformat -Werror=format-security
  OBJCXXFLAGS=-g -O2 -fdebug-prefix-map=/home/rlb/src/guile=. -fstack-protector-strong -Wformat -Werror=format-security

In current Debian unstable, this crashes in test-out-of-memory as above:

  PASS: test-smob-mark
  PASS: test-smob-mark-race
  wrote `/<<BUILDDIR>>/guile-2.2-2.2.3+1/cache/guile/ccache/2.2-LE-8-3.A/<<BUILDDIR>>/guile-2.2-2.2.3+1/test-suite/standalone/test-stack-overflow.go'
  allocate_stack failed: Cannot allocate memory
  allocate_stack failed: Cannot allocate memory
  allocate_stack failed: Cannot allocate memory
  allocate_stack failed: Cannot allocate memory
  allocate_stack failed: Cannot allocate memory
  PASS: test-stack-overflow
  wrote `/<<BUILDDIR>>/guile-2.2-2.2.3+1/cache/guile/ccache/2.2-LE-8-3.A/<<BUILDDIR>>/guile-2.2-2.2.3+1/test-suite/standalone/test-out-of-memory.go'
  GC Warning: Failed to expand heap by 134348800 bytes
  GC Warning: Failed to expand heap by 134217728 bytes
  GC Warning: Out of Memory! Heap size: 1 MiB. Returning NULL!
  error creating finalization thread: Cannot allocate memory
  GC Warning: Failed to expand heap by 1000132608 bytes
  GC Warning: Failed to expand heap by 1000001536 bytes
  GC Warning: Out of Memory! Heap size: 1 MiB. Returning NULL!
  GC Warning: Failed to expand heap by 499712 bytes
  GC Warning: Failed to expand heap by 65536 bytes
  GC Warning: Out of Memory! Heap size: 1 MiB. Returning NULL!
  GC Warning: Failed to expand heap by 499712 bytes
  GC Warning: Failed to expand heap by 65536 bytes
  GC Warning: Out of Memory! Heap size: 1 MiB. Returning NULL!
  Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
  FAIL: test-out-of-memory
  ==================================
  1 of 39 tests failed
  Please report to [email-masked]
  ==================================

After investigating for a while, I found that just this was enough to
cause the crash when building from the 2.2.3 release archive:

  CFLAGS='-fstack-protector-strong' ./configure
  make check

If that flag is the problem, I'm wondering whether for now I'd be better
off quashing it, or temporarily disabling the test.  i.e. is the test
detecting that something's actually wrong, or does the flag just break
one of the test's assumptions?

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4