Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-11 Thread O. Hartmann
On 01/11/13 00:39, Dimitry Andric wrote: On 2013-01-08 09:58, Stefan Farfeleder wrote: On Tue, Jan 08, 2013 at 12:21:12AM +0100, Dimitry Andric wrote: ... After a lot of splitting up of unwind-dw2.c, I arrived at _Unwind_Resume which when compiled by clang caused the crashes, but when

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-11 Thread Larry Rosenman
On 2013-01-11 02:19, O. Hartmann wrote: On 01/11/13 00:39, Dimitry Andric wrote: On 2013-01-08 09:58, Stefan Farfeleder wrote: On Tue, Jan 08, 2013 at 12:21:12AM +0100, Dimitry Andric wrote: ... After a lot of splitting up of unwind-dw2.c, I arrived at _Unwind_Resume which when compiled by

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-10 Thread Dimitry Andric
On 2013-01-08 09:58, Stefan Farfeleder wrote: On Tue, Jan 08, 2013 at 12:21:12AM +0100, Dimitry Andric wrote: ... After a lot of splitting up of unwind-dw2.c, I arrived at _Unwind_Resume which when compiled by clang caused the crashes, but when compiled by gcc ran OK. your patch seems to work

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-10 Thread Stefan Farfeleder
On Fri, Jan 11, 2013 at 12:39:44AM +0100, Dimitry Andric wrote: On 2013-01-08 09:58, Stefan Farfeleder wrote: On Tue, Jan 08, 2013 at 12:21:12AM +0100, Dimitry Andric wrote: ... After a lot of splitting up of unwind-dw2.c, I arrived at _Unwind_Resume which when compiled by clang caused the

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-08 Thread David Chisnall
On 7 Jan 2013, at 23:21, Dimitry Andric wrote: This is at least the direction I'm looking at. It seems that in some cases with __builtin_eh_return(), llvm does not see that registers can be clobbered, and it doesn't save and restore them. Do you mean that some registers were clobbered by a

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-08 Thread Stefan Farfeleder
On Tue, Jan 08, 2013 at 12:21:12AM +0100, Dimitry Andric wrote: On 2013-01-06 17:03, Stefan Farfeleder wrote: On Sun, Jan 06, 2013 at 03:59:59PM +0100, Dimitry Andric wrote: ... The bug also affects ports software, e.g., I also experienced strange rtorrent segfaults that are now gone.

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-08 Thread Dimitry Andric
On 2013-01-08 09:08, David Chisnall wrote: On 7 Jan 2013, at 23:21, Dimitry Andric wrote: This is at least the direction I'm looking at. It seems that in some cases with __builtin_eh_return(), llvm does not see that registers can be clobbered, and it doesn't save and restore them. Do you mean

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-08 Thread Борис Самородов
08.01.2013 03:21, Dimitry Andric пишет: Can you please try the attached patch, which is a very horrid, atrocious hack, and will only work for amd64. Then rebuild libgcc with clang, and please try if this fixes at least some of the crashes... The patch fixed building editors/libreoffice.

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-07 Thread Stefan Farfeleder
On Sun, Jan 06, 2013 at 04:51:11PM +, David Chisnall wrote: On 6 Jan 2013, at 16:48, Nathan Whitehorn wrote: No. It's completely broken at all optimization levels. There do not appear to be any flags that change the behavior. Building unwind-dw2.c either with gcc or with the previous

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-07 Thread Dimitry Andric
On 2013-01-06 17:03, Stefan Farfeleder wrote: On Sun, Jan 06, 2013 at 03:59:59PM +0100, Dimitry Andric wrote: ... The bug also affects ports software, e.g., I also experienced strange rtorrent segfaults that are now gone. Can you please try the attached patch, which is a very horrid,

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Stefan Farfeleder
On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply something like this as a work-around? Stefan Index: gnu/lib/libgcc/Makefile

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Dimitry Andric
On 2013-01-06 15:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply something like this as a work-around? Stefan Index: gnu/lib/libgcc/Makefile

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Nathan Whitehorn
On 01/06/13 09:59, Dimitry Andric wrote: On 2013-01-06 15:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply something like this as a

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Stefan Farfeleder
On Sun, Jan 06, 2013 at 03:59:59PM +0100, Dimitry Andric wrote: On 2013-01-06 15:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Nathan Whitehorn
On 01/06/13 10:29, Nathan Whitehorn wrote: On 01/06/13 09:59, Dimitry Andric wrote: On 2013-01-06 15:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread David Chisnall
On 6 Jan 2013, at 14:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply something like this as a work-around? Stefan Index:

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread Nathan Whitehorn
On 01/06/13 11:46, David Chisnall wrote: On 6 Jan 2013, at 14:17, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: [...] Until someone fixes this bug, could we apply something like this as a

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-06 Thread David Chisnall
On 6 Jan 2013, at 16:48, Nathan Whitehorn wrote: No. It's completely broken at all optimization levels. There do not appear to be any flags that change the behavior. Building unwind-dw2.c either with gcc or with the previous import of clang in our tree does fix it, however. Do you have an

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-05 Thread Stefan Farfeleder
On Fri, Jan 04, 2013 at 10:23:34PM +0200, Konstantin Belousov wrote: Thank you for digging more. In fact, it is more likely that there is some bug or incompatibility in c++ unwinder than in the libgcc itself, but as you noted, a compiler bug is also possible. Anyway, I was mostly

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Stefan Farfeleder
On Wed, Jan 02, 2013 at 02:59:50PM +0100, Stefan Farfeleder wrote: On Sun, Dec 30, 2012 at 11:17:10PM +0100, Dimitry Andric wrote: I have been playing with Stefan's testcase for a while now, and while I can reproduce the crashes, I am still at a loss about the cause. It does seem to

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Konstantin Belousov
On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: On Wed, Jan 02, 2013 at 02:59:50PM +0100, Stefan Farfeleder wrote: On Sun, Dec 30, 2012 at 11:17:10PM +0100, Dimitry Andric wrote: I have been playing with Stefan's testcase for a while now, and while I can reproduce

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Stefan Farfeleder
On Fri, Jan 04, 2013 at 08:14:38PM +0200, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: $ cat throw-crash.cc #include stdexcept void f2(void) { std::string s; throw

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Konstantin Belousov
On Fri, Jan 04, 2013 at 08:06:02PM +0100, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 08:14:38PM +0200, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces the bug: $ cat throw-crash.cc

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Mark Atkinson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/04/2013 12:23, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 08:06:02PM +0100, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 08:14:38PM +0200, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-04 Thread Nathan Whitehorn
On 01/04/13 15:23, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 08:06:02PM +0100, Stefan Farfeleder wrote: On Fri, Jan 04, 2013 at 08:14:38PM +0200, Konstantin Belousov wrote: On Fri, Jan 04, 2013 at 04:49:41PM +0100, Stefan Farfeleder wrote: Here's a minimal test case that reproduces

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-02 Thread Stefan Farfeleder
On Sun, Dec 30, 2012 at 11:17:10PM +0100, Dimitry Andric wrote: I have been playing with Stefan's testcase for a while now, and while I can reproduce the crashes, I am still at a loss about the cause. It does seem to have something to do with throwing exceptions, but I am still not sure

Re: clang 3.2 RC2 miscompiles libgcc?

2013-01-02 Thread Eitan Adler
On 2 January 2013 08:59, Stefan Farfeleder stef...@freebsd.org wrote: On Sun, Dec 30, 2012 at 11:17:10PM +0100, Dimitry Andric wrote: I have been playing with Stefan's testcase for a while now, and while I can reproduce the crashes, I am still at a loss about the cause. It does seem to have

Re: clang 3.2 RC2 miscompiles libgcc?

2012-12-30 Thread Dimitry Andric
On 2012-12-27 16:15, Nathan Whitehorn wrote: On 12/27/12 09:07, Stefan Farfeleder wrote: I noticed that most of my C++ applications in recent versions of FreeBSD head suddenly crash without me recompiling them. I tracked it down to r243830 which imported a new clang version. The new clang seems

clang 3.2 RC2 miscompiles libgcc?

2012-12-27 Thread Stefan Farfeleder
Hi, I noticed that most of my C++ applications in recent versions of FreeBSD head suddenly crash without me recompiling them. I tracked it down to r243830 which imported a new clang version. The new clang seems to compile libgcc in a wrong or at least incompatible way with what gcc expects. In

Re: clang 3.2 RC2 miscompiles libgcc?

2012-12-27 Thread Nathan Whitehorn
On 12/27/12 09:07, Stefan Farfeleder wrote: Hi, I noticed that most of my C++ applications in recent versions of FreeBSD head suddenly crash without me recompiling them. I tracked it down to r243830 which imported a new clang version. The new clang seems to compile libgcc in a wrong or at

Re: clang 3.2 RC2 miscompiles libgcc?

2012-12-27 Thread Stefan Farfeleder
On Thu, Dec 27, 2012 at 09:15:01AM -0600, Nathan Whitehorn wrote: On 12/27/12 09:07, Stefan Farfeleder wrote: Hi, I noticed that most of my C++ applications in recent versions of FreeBSD head suddenly crash without me recompiling them. I tracked it down to r243830 which imported a new