Re: Package segfaults when built with -O2 but not with -O0

2011-12-06 Thread Paul Howarth
On 12/02/2011 02:08 PM, Paul Howarth wrote: > On 12/02/2011 04:12 AM, Ralf Corsepius wrote: >> On 12/01/2011 07:11 PM, Paul Howarth wrote: >>> On Thu, 01 Dec 2011 15:45:48 +0100 >>> Ralf Corsepius wrote: >>> On 12/01/2011 11:23 AM, Paul Howarth wrote: > Ralf, > > On 11/18/2011 05:

Re: Package segfaults when built with -O2 but not with -O0

2011-12-02 Thread Paul Howarth
On 12/02/2011 04:12 AM, Ralf Corsepius wrote: > On 12/01/2011 07:11 PM, Paul Howarth wrote: >> On Thu, 01 Dec 2011 15:45:48 +0100 >> Ralf Corsepius wrote: >> >>> On 12/01/2011 11:23 AM, Paul Howarth wrote: Ralf, On 11/18/2011 05:53 PM, Ralf Corsepius wrote: > On 11/18/2011 05:32

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Ralf Corsepius
On 12/01/2011 07:11 PM, Paul Howarth wrote: > On Thu, 01 Dec 2011 15:45:48 +0100 > Ralf Corsepius wrote: > >> On 12/01/2011 11:23 AM, Paul Howarth wrote: >>> Ralf, >>> >>> On 11/18/2011 05:53 PM, Ralf Corsepius wrote: On 11/18/2011 05:32 PM, Paul Howarth wrote: > It already builds with -W

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Paul Howarth
On Thu, 01 Dec 2011 21:19:14 +0100 Kevin Kofler wrote: > Paul Howarth wrote: > > This is weird: I can't reproduce these either locally in mock or in > > koji: > > > > http://koji.fedoraproject.org/koji/taskinfo?taskID=3555838 > > -Wstrict-aliasing only works if -fstrict-aliasing is enabled, so

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Kevin Kofler
Paul Howarth wrote: > This is weird: I can't reproduce these either locally in mock or in > koji: > > http://koji.fedoraproject.org/koji/taskinfo?taskID=3555838 -Wstrict-aliasing only works if -fstrict-aliasing is enabled, so if you're using -fno-strict-aliasing (or an optimization level below -

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Paul Howarth
On Thu, 01 Dec 2011 15:45:48 +0100 Ralf Corsepius wrote: > On 12/01/2011 11:23 AM, Paul Howarth wrote: > > Ralf, > > > > On 11/18/2011 05:53 PM, Ralf Corsepius wrote: > >> On 11/18/2011 05:32 PM, Paul Howarth wrote: > >>> It already builds with -Wall and there are no warnings: > >> This doesn't m

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Ralf Corsepius
On 12/01/2011 11:23 AM, Paul Howarth wrote: > Ralf, > > On 11/18/2011 05:53 PM, Ralf Corsepius wrote: >> On 11/18/2011 05:32 PM, Paul Howarth wrote: >>> It already builds with -Wall and there are no warnings: >> This doesn't mean much. >> >> Adding a couple of more agressive options, this is what h

Re: Package segfaults when built with -O2 but not with -O0

2011-12-01 Thread Paul Howarth
Ralf, On 11/18/2011 05:53 PM, Ralf Corsepius wrote: > On 11/18/2011 05:32 PM, Paul Howarth wrote: >> It already builds with -Wall and there are no warnings: > This doesn't mean much. > > Adding a couple of more agressive options, this is what happens to pptp: > > orckit_quirks.c:65:2: warning: mis

Re: Package segfaults when built with -O2 but not with -O0

2011-11-22 Thread Henrik Nordström
lör 2011-11-19 klockan 00:23 -0500 skrev Gregory Maxwell: > This use to be more true, but there are multiple levels of -Wstrict-aliasing > and > I would be _highly_ surprised if the default gave a false alarm. I think you > can reliably say that if you get a warning at the default level then you

Re: Package segfaults when built with -O2 but not with -O0

2011-11-19 Thread Kevin Kofler
Ralf Corsepius wrote: > On 11/19/2011 06:23 AM, Gregory Maxwell wrote: >> On Fri, Nov 18, 2011 at 11:27 PM, Ralf Corsepius >> wrote: >>> If GCC is sure something is wrong, it is supposed to raise errors. >> >> This isn't true. E.g. you can write code which reads and uses >> uninitialized memory >

Re: Package segfaults when built with -O2 but not with -O0

2011-11-19 Thread Ralf Corsepius
On 11/19/2011 06:23 AM, Gregory Maxwell wrote: > On Fri, Nov 18, 2011 at 11:27 PM, Ralf Corsepius wrote: >> [1] -Wstrict-aliasing is one of these cases. >> The spots such warnings point to, often are broken, but not always, >> because GCC has difficulties in identifying these. > > This use to be m

Re: Package segfaults when built with -O2 but not with -O0

2011-11-19 Thread Ralf Corsepius
On 11/19/2011 01:23 PM, Andrew Haley wrote: > On 11/18/2011 11:32 PM, Tom Lane wrote: >> Andrew Haley writes: On 11/18/2011 05:53 PM, Ralf Corsepius wrote: >> pptp.c:459:33: warning: dereferencing type-punned pointer might break >> strict-aliasing rules [-Wstrict-aliasing] Bingo!

Re: Package segfaults when built with -O2 but not with -O0

2011-11-19 Thread Andrew Haley
On 11/18/2011 11:32 PM, Tom Lane wrote: > Andrew Haley writes: >> > On 11/18/2011 05:53 PM, Ralf Corsepius wrote: >>> >> pptp.c:459:33: warning: dereferencing type-punned pointer might break >>> >> strict-aliasing rules [-Wstrict-aliasing] >> > Bingo! Bugs like this must be fixed. > Sometimes th

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Gregory Maxwell
On Fri, Nov 18, 2011 at 11:27 PM, Ralf Corsepius wrote: > [1] -Wstrict-aliasing is one of these cases. > The spots such warnings point to, often are broken, but not always, > because GCC has difficulties in identifying these. This use to be more true, but there are multiple levels of -Wstrict-ali

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Ralf Corsepius
On 11/19/2011 04:57 AM, Xose Vazquez Perez wrote: > Kevin Kofler wrote: > >> Indeed, -Wall is not really all. :-) -Wall -Wextra is closer to all, but >> there are still some things those won't warn about, e.g. -Wwrite-strings >> catches places which use a string literal as a potentially writable ch

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Xose Vazquez Perez
Kevin Kofler wrote: > Indeed, -Wall is not really all. :-) -Wall -Wextra is closer to all, but > there are still some things those won't warn about, e.g. -Wwrite-strings > catches places which use a string literal as a potentially writable char * > instead of a const char *. -O2 is required by

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Kevin Kofler
Paul Howarth wrote: > Hmm, thanks for that. I naively assumed that -Wall was "all warnings"! > I'll look into those. Indeed, -Wall is not really all. :-) -Wall -Wextra is closer to all, but there are still some things those won't warn about, e.g. -Wwrite-strings catches places which use a string

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Tom Lane
Andrew Haley writes: > On 11/18/2011 05:53 PM, Ralf Corsepius wrote: >> pptp.c:459:33: warning: dereferencing type-punned pointer might break >> strict-aliasing rules [-Wstrict-aliasing] > Bingo! Bugs like this must be fixed. Sometimes that's easier said than done. -fno-strict-aliasing might

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Andrew Haley
On 11/18/2011 05:53 PM, Ralf Corsepius wrote: > pptp.c:459:33: warning: dereferencing type-punned pointer might break > strict-aliasing rules [-Wstrict-aliasing] Bingo! Bugs like this must be fixed. Andrew. -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/ma

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Paul Howarth
On Fri, 18 Nov 2011 18:53:03 +0100 Ralf Corsepius wrote: > On 11/18/2011 05:32 PM, Paul Howarth wrote: > > On Fri, 18 Nov 2011 15:28:27 + > > Andrew Haley wrote: > > > >> On 11/18/2011 11:31 AM, Paul Howarth wrote: > >>> One of my packages, pptp, suffers occasional segfaults as reported > >>

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Paul Howarth
On Fri, 18 Nov 2011 18:43:30 +0200 Jussi Lehtola wrote: > On Fri, 18 Nov 2011 16:32:23 + > Paul Howarth wrote: > > On Fri, 18 Nov 2011 15:28:27 + > > Andrew Haley wrote: > > > > > On 11/18/2011 11:31 AM, Paul Howarth wrote: > > > > One of my packages, pptp, suffers occasional segfaults

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Ralf Corsepius
On 11/18/2011 05:32 PM, Paul Howarth wrote: > On Fri, 18 Nov 2011 15:28:27 + > Andrew Haley wrote: > >> On 11/18/2011 11:31 AM, Paul Howarth wrote: >>> One of my packages, pptp, suffers occasional segfaults as reported >>> in http://bugzilla.redhat.com/749455. However, whilst investigating >>>

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Jussi Lehtola
On Fri, 18 Nov 2011 16:32:23 + Paul Howarth wrote: > On Fri, 18 Nov 2011 15:28:27 + > Andrew Haley wrote: > > > On 11/18/2011 11:31 AM, Paul Howarth wrote: > > > One of my packages, pptp, suffers occasional segfaults as reported > > > in http://bugzilla.redhat.com/749455. However, whilst

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Paul Howarth
On Fri, 18 Nov 2011 15:28:27 + Andrew Haley wrote: > On 11/18/2011 11:31 AM, Paul Howarth wrote: > > One of my packages, pptp, suffers occasional segfaults as reported > > in http://bugzilla.redhat.com/749455. However, whilst investigating > > this, it seems to be the case that simply rebuild

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Gregory Maxwell
On Fri, Nov 18, 2011 at 6:31 AM, Paul Howarth wrote: > 2. How to determine what the actual problem is, e.g. a problem with the > way the code is written leading to unsafe optimizations, or a gcc bug? [Obviously Andrew's look at warnings advice is good but also…] See if you can reproduce it when

Re: Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Andrew Haley
On 11/18/2011 11:31 AM, Paul Howarth wrote: > One of my packages, pptp, suffers occasional segfaults as reported in > http://bugzilla.redhat.com/749455. However, whilst investigating this, > it seems to be the case that simply rebuilding the package using no > optimization (-O0) as opposed to the d

Package segfaults when built with -O2 but not with -O0

2011-11-18 Thread Paul Howarth
One of my packages, pptp, suffers occasional segfaults as reported in http://bugzilla.redhat.com/749455. However, whilst investigating this, it seems to be the case that simply rebuilding the package using no optimization (-O0) as opposed to the default -O2 is enough to stop this happening. This r