The GCC optimizer generates code that cause a segmentation violation in snprintf if the lnstat command from iproute2 utilities is build with -O1 or -O2.
System: Intel Core Duo (64 bit) Version: gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) Backtrace: ]$ gdb ./lnstat GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... (gdb) run Starting program: /home/shemminger/src/iproute2/misc/lnstat Program received signal SIGSEGV, Segmentation fault. 0x00007f81a655c9d4 in vsnprintf () from /lib/libc.so.6 (gdb) where #0 0x00007f81a655c9d4 in vsnprintf () from /lib/libc.so.6 #1 0x00007f81a653ef73 in snprintf () from /lib/libc.so.6 #2 0x00000000004015f3 in main () -- Summary: lnstat command dies if built with O1/O2 Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: shemminger at vyatta dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36679