[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#902002: abnormal handling of exceptions



Package: g++-7-arm-linux-gnueabihf
Version: 7.3.0-20cross1
Severity: normal

My colleagues and me have stumbled upon a very strange bug when
compiling and linking software for armhf target. Using two attached
source files:

$ g++ -g -c test.cc && gcc -g -c test2.c && g++ -g -static -o test test.o test2.o && ./test
Exception!
$ arm-linux-gnueabi-g++ -g -c test.cc && arm-linux-gnueabi-gcc -g -c test2.c && arm-linux-gnueabi-g++ -g -static -o test test.o test2.o && qemu-arm -L /usr/lib/arm-linux-gnueabi ./test
Exception!
$ arm-linux-gnueabihf-g++ -g -c test.cc && arm-linux-gnueabihf-gcc -g -c test2.c && arm-linux-gnueabihf-g++ -g -static -o test test.o test2.o && qemu-arm -L /usr/lib/arm-linux-gnueabihf ./test
terminate called after throwing an instance of 'std::exception'
terminate called recursively
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

I'm using qemu to demonstrate behaviour, however exactly the same
results can be seen on real hardware.


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.16.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages g++-7-arm-linux-gnueabihf depends on:
ii  gcc-7-arm-linux-gnueabihf       7.3.0-20cross1
ii  gcc-7-arm-linux-gnueabihf-base  7.3.0-20cross1
ii  libc6                           2.27-3
ii  libgmp10                        2:6.1.2+dfsg-3
ii  libisl19                        0.19-1
ii  libmpc3                         1.1.0-1
ii  libmpfr6                        4.0.1-1
ii  libstdc++-7-dev-armhf-cross     7.3.0-20cross1
ii  zlib1g                          1:1.2.11.dfsg-1

g++-7-arm-linux-gnueabihf recommends no packages.

Versions of packages g++-7-arm-linux-gnueabihf suggests:
ii  gcc-7-doc                     7.2.0-1
pn  libstdc++6-7-dbg-armhf-cross  <none>

-- no debconf information
#include <stdexcept>
#include <cstdio>

int main() {
        try {
                throw std::exception();
        }
        catch (...) {
                printf ("Exception!\n");
        }
}
#include <stdio.h>

void init(void)
{
	fseek(NULL, 0, SEEK_SET);
}

Reply to: