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

Paul Howarth paul at city-fan.org
Tue Dec 6 12:22:10 UTC 2011


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<rc040203 at freenet.de>  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 mean much.
>>>>>>
>>>>>> Adding a couple of more agressive options, this is what happens to
>>>>>> pptp:
>>>>>>
>>>>
>>>>> What were the "couple of more agressive options" you used,
>>>>
>>>> This is what I did (rebased against today's git):
>>>>
>>>> diff --git a/pptp.spec b/pptp.spec
>>>> index 289dd08..78e36ca 100644
>>>> --- a/pptp.spec
>>>> +++ b/pptp.spec
>>>> @@ -86,7 +86,7 @@ tunnels.
>>>> perl -pi -e 's/install -o root -m 555 pptp/install -m 755 pptp/;'
>>>> Makefile
>>>>
>>>> %build
>>>> -make %{?_smp_mflags} CFLAGS="-Wall %{optflags}" IP=/sbin/ip
>>>> +make %{?_smp_mflags} CFLAGS="-Wall %{optflags} -Wextra
>>>> -Wstrict-aliasing -Wnested-externs -Wstrict-prototypes" IP=/sbin/ip
>>>>
>>>> %install
>>>> rm -rf %{buildroot}
>>>>
>>>>
>>>>> and which
>>>>> distro?
>>>>
>>>> Local rawhide mock.
>>>>
>>>> The result I posted was extracted from a "fedpkg mockbuild"'s
>>>> build.log in a local mock on fedora-16/x86_64.
>>>>
>>>>
>>>>> I've tried "-Wall -Wextra" and still can't provoke the strict
>>>>> aliasing warning locally.
>>>> -Wstrict-aliasing is responsible for this warning.
>>>>
>>>> Today's version looks like this:
>>>>
>>>> # grep warning: results_pptp/1.7.2/13.fc17/build.log | grep punned
>>>> pptp_gre.c:92:29: warning: dereferencing type-punned pointer might
>>>> break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp_gre.c:99:28: warning: dereferencing type-punned pointer might
>>>> break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp_callmgr.c:202:48: warning: dereferencing type-punned pointer
>>>> might break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp_callmgr.c:325:29: warning: dereferencing type-punned pointer
>>>> might break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp_callmgr.c:330:28: warning: dereferencing type-punned pointer
>>>> might break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp_callmgr.c:358:25: warning: dereferencing type-punned pointer
>>>> might break strict-aliasing rules [-Wstrict-aliasing]
>>>> pptp.c:459:33: warning: dereferencing type-punned pointer might break
>>>> strict-aliasing rules [-Wstrict-aliasing]
>>>
>>> This is weird: I can't reproduce these either locally in mock or in
>>> koji:
>> Neither can I ;)
>>
>>> http://koji.fedoraproject.org/koji/taskinfo?taskID=3555838
>>
>> ... mock appends build.log's from subsequent mock runs ...
>>
>> ... the warnings above stem from older builds.
>>
>> I had not cleaned up the build.log when "git merging" your recent
>> changes into my git checkout.
>
> Hmm, that sort of explains it - except that even if I don't apply any of
> the last few patches since the F14 version, I *still* can't provoke a
> strict-aliasing warning.

Got it: I had to use -Wstrict-aliasing=2

Paul.


More information about the devel mailing list