gcc 4.3.1-lubuntu2 debug code crashes in 8.10 with sigsegv in strlen
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gcc
I have a small source file which produces a sigsegv in debug code but runs fine optimised to -O3. However, assembler from SuSE compiler or gcc 4.3.3 built on ubuntu 8.10 from gcc.gnu.org source does not crash.
$ apt-cache policy gcc
gcc:
Installed: 4:4.3.1-1ubuntu2
Candidate: 4:4.3.1-1ubuntu2
Version table:
*** 4:4.3.1-1ubuntu2 0
500 http://
100 /var/lib/
$ gcc -g soundex.c -o soundex
$ ./soundex burroughs ashcroft brc mcknight mcnaught mcknawght
strlen("burroughs")
B620 burroughs
strlen("ashcroft")
Segmentation fault
Package gcc-3.4 also causes crash:
$ gcc-3.4 -g soundex.c -o soundex
$ ./soundex burroughs ashcroft brc mcknight mcnaught mcknawght
strlen("burroughs")
B620 burroughs
strlen("ashcroft")
Segmentation fault
$ apt-cache policy gcc-3.4
gcc-3.4:
Installed: 3.4.6-8ubuntu2
Candidate: 3.4.6-8ubuntu2
Version table:
*** 3.4.6-8ubuntu2 0
500 http://
100 /var/lib/
strlen() does not crash if optimised in line (or if I use a home-brew compiler or SuSE compiler):
$ gcc -O3 soundex.c -o soundex
$ ./soundex burroughs ashcroft brc mcknight mcnaught mcknawght
strlen("burroughs")
B620 burroughs
strlen("ashcroft")
A261 ashcroft
strlen("brc")
B620 brc
strlen("mcknight")
M252 mcknight
strlen("mcnaught")
M252 mcnaught
strlen("mcknawght")
M252 mcknawght
Many apologies, bug in line 66 of source - should be:
while (src < end && dst < lim) {
I was polluting the stack - so hardly surprising that it crashed.