Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2012-05-19 Thread Dimitry Andric
On 2011-12-10 02:21, Gleb Kurtsou wrote: Please find test case and test results attached. (gcc-test1.shar.txt) The long story short: only gcc-4.2 is affected, gcc 3.4, 4.4 and 4.6 are ok. clang is ok. (test-cc.txt) Nearly all of the workarounds I used in original test doesn't work in this

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Rafal Jaworowski
On 2011-12-08, at 17:53, Nathan Whitehorn wrote: On 12/08/11 03:01, Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC sometimes very unfortunately optimize code with -fno-omit-frame-pointer. Example

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Arnaud Lacombe
Hi, On Fri, Dec 9, 2011 at 10:15 AM, Rafal Jaworowski r...@semihalf.com wrote: On 2011-12-08, at 17:53, Nathan Whitehorn wrote: On 12/08/11 03:01, Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Gleb Kurtsou
On (09/12/2011 16:15), Rafal Jaworowski wrote: On 2011-12-08, at 17:53, Nathan Whitehorn wrote: On 12/08/11 03:01, Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC sometimes very unfortunately

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Chris Rees
On 9 Dec 2011 17:51, Arnaud Lacombe lacom...@gmail.com wrote: Hi, On Fri, Dec 9, 2011 at 10:15 AM, Rafal Jaworowski r...@semihalf.com wrote: On 2011-12-08, at 17:53, Nathan Whitehorn wrote: On 12/08/11 03:01, Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Ryan Stone
On Fri, Dec 9, 2011 at 1:15 PM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: -fno-omit-frame-pointer is there for kernel debugger to be able to generate backtraces. It's also needed by the DTrace stack() action, hwpmc callchain capture and stack(9). Disabling it as anything other than a very

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-09 Thread Gleb Kurtsou
Please find test case and test results attached. (gcc-test1.shar.txt) The long story short: only gcc-4.2 is affected, gcc 3.4, 4.4 and 4.6 are ok. clang is ok. (test-cc.txt) Nearly all of the workarounds I used in original test doesn't work in this test case (see #ifdef BAD_FIX in sources). gcc

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-08 Thread Rafal Jaworowski
On 2011-12-07, at 21:28, Arnaud Lacombe wrote: Hi, On Sat, Nov 19, 2011 at 5:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-08 Thread Gleb Kurtsou
On (08/12/2011 10:01), Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC sometimes very unfortunately optimize code with -fno-omit-frame-pointer. Example shown below covers file sys/powerc/booke/pmap.c

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-08 Thread Piotr Nowak
We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC sometimes very unfortunately optimize code with -fno-omit-frame-pointer. Example shown below covers file sys/powerc/booke/pmap.c and function pmap_kenter. If we disassemble

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-08 Thread Nathan Whitehorn
On 12/08/11 03:01, Piotr Nowak wrote: We're working on PowerPC target using GCC 4.2.1 and FreeBSD 6.1. It seems like we have similar problem. In our case GCC sometimes very unfortunately optimize code with -fno-omit-frame-pointer. Example shown below covers file sys/powerc/booke/pmap.c and

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-08 Thread Alexander Kabaev
On Sat, 19 Nov 2011 12:01:50 +0200 Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with gcc

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-07 Thread Arnaud Lacombe
Hi, On Sat, Nov 19, 2011 at 5:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with gcc

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-02 Thread Stanislav Sedov
On Sat, 19 Nov 2011 12:01:50 +0200 Gleb Kurtsou gleb.kurt...@gmail.com mentioned: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-12-02 Thread Gleb Kurtsou
On (02/12/2011 01:56), Stanislav Sedov wrote: On Sat, 19 Nov 2011 12:01:50 +0200 Gleb Kurtsou gleb.kurt...@gmail.com mentioned: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-20 Thread Gleb Kurtsou
On (19/11/2011 09:11), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 8:19 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: On (19/11/2011 07:26), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 2:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-20 Thread Gleb Kurtsou
On (20/11/2011 01:57), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: On (19/11/2011 12:25), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-20 Thread Alexander Best
On Sun Nov 20 11, Gleb Kurtsou wrote: On (20/11/2011 01:57), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: On (19/11/2011 12:25), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-20 Thread mdf
On Sun, Nov 20, 2011 at 10:24 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: On (19/11/2011 09:11), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 8:19 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: On (19/11/2011 07:26), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 2:01 AM, Gleb Kurtsou

gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread Gleb Kurtsou
Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with gcc 4.3, gcc 4.4 on FreeBSD and Linux. Clang from base is also good. -O and -Os

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread Alexander Best
On Sat Nov 19 11, Gleb Kurtsou wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with gcc 4.3, gcc 4.4 on FreeBSD and Linux. Clang

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread Gleb Kurtsou
On (19/11/2011 12:25), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread mdf
On Sat, Nov 19, 2011 at 2:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last gcc 4.2 snapshot from ports. It works with gcc 4.3,

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread Gleb Kurtsou
On (19/11/2011 07:26), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 2:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system and last

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread mdf
On Sat, Nov 19, 2011 at 8:19 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: On (19/11/2011 07:26), m...@freebsd.org wrote: On Sat, Nov 19, 2011 at 2:01 AM, Gleb Kurtsou gleb.kurt...@gmail.com wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2.

Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64

2011-11-19 Thread Alexander Best
On Sat Nov 19 11, Gleb Kurtsou wrote: On (19/11/2011 12:25), Alexander Best wrote: On Sat Nov 19 11, Gleb Kurtsou wrote: Hi, I was lucky to write a bit of code which gcc 4.2 fails to compile correctly with -O2. Too keep long story short the code fails for gcc from base system