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

Paul Howarth paul at city-fan.org
Thu Dec 1 10:23:16 UTC 2011


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: missing initializer
> [-Wmissing-field-initializers]
> orckit_quirks.c:65:2: warning: (near initialization for
> 'fixed_packet.header.pptp_type') [-Wmissing-field-initializers]
> pptp.c:147:21: warning: unused parameter 'sig' [-Wunused-parameter]
> pptp.c:153:19: warning: unused parameter 'sig' [-Wunused-parameter]
> pptp.c:459:33: warning: dereferencing type-punned pointer might break
> strict-aliasing rules [-Wstrict-aliasing]
> pptp.c:492:65: warning: unused parameter 'argc' [-Wunused-parameter]
> pptp_callmgr.c:105:48: warning: unused parameter 'envp' [-Wunused-parameter]
> pptp_callmgr.c:202:48: warning: dereferencing type-punned pointer might
> break strict-aliasing rules [-Wstrict-aliasing]
> pptp_callmgr.c:215:17: warning: ignoring return value of 'read',
> declared with attribute warn_unused_result [-Wunused-result]
> pptp_callmgr.c:216:17: warning: ignoring return value of 'read',
> declared with attribute warn_unused_result [-Wunused-result]
> 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_callmgr.c:368:44: warning: unused parameter 'inetaddr'
> [-Wunused-parameter]
> pptp_callmgr.c:39:29: warning: unused parameter 'sig' [-Wunused-parameter]
> pptp_callmgr.c:44:29: warning: unused parameter 'sig' [-Wunused-parameter]
> pptp_callmgr.c:71:18: warning: ignoring return value of 'write',
> declared with attribute warn_unused_result [-Wunused-result]
> pptp_ctrl.c:1062:13: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pptp_ctrl.c:177:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pptp_ctrl.c:206:31: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_ctrl.c:245:13: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_ctrl.c:535:14: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:237:27: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:241:30: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:249:18: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:260:23: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:441:26: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:446:23: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:493:27: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:527:19: warning: comparison between signed and unsigned
> integer expressions [-Wsign-compare]
> pptp_gre.c:74:10: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pptp_gre.c:85:19: warning: nested extern declaration of 'localbind'
> [-Wnested-externs]
> 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_quirks.c:33:5: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pptp_quirks.h:56:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pqueue.c:220:11: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> pqueue.h:27:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> routing.c:117:8: warning: ignoring return value of 'fgets', declared
> with attribute warn_unused_result [-Wunused-result]
> routing.c:125:6: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> routing.c:155:6: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> routing.h:2:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> routing.h:3:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> test.c:145:14: warning: comparison between signed and unsigned integer
> expressions [-Wsign-compare]
> test.c:174:27: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> test.c:55:16: warning: comparison between signed and unsigned integer
> expressions [-Wsign-compare]
> test.c:99:14: warning: comparison between signed and unsigned integer
> expressions [-Wsign-compare]
> test.h:5:8: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.c:121:8: warning: ignoring return value of 'write', declared with
> attribute warn_unused_result [-Wunused-result]
> util.c:136:5: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.c:142:5: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.c:145:7: warning: ignoring return value of 'read', declared with
> attribute warn_unused_result [-Wunused-result]
> util.c:149:6: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.c:90:5: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.h:38:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.h:47:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.h:50:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> util.h:52:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> vector.c:38:9: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
> vector.h:15:1: warning: function declaration isn't a prototype
> [-Wstrict-prototypes]
>
> I can't spot anything obvious, but each of these are potential candiates
> for issues and should be inspected.

What were the "couple of more agressive options" you used, and which 
distro? I've tried "-Wall -Wextra" and still can't provoke the strict 
aliasing warning locally.

Paul.


More information about the devel mailing list