Share

Small Device C Compiler

Tracker: Bugs

5 Crash in peephole optimizer - ID: 1947081
Last Update: Comment added ( spth )

I observe a crash (signal 11) in the peephole optimizer.

To reproduce:
Replace the content of src/z80/peeph.def by

replace restart {
pop %1
push %2
} by {
}

sdcc crashes when building asincosf from the library.

Philipp


Philipp Krause ( spth ) - 2008-04-20 08:43

5

Closed

Fixed

Philipp Krause

peephole optimizer

fixed

Public


Comments ( 2 )

Date: 2009-08-05 22:03
Sender: spth

Fixed in rev #5486.


Date: 2009-07-29 10:19
Sender: fullmetalcoder

Proposed fix :

SDCCpeep.c in static void replaceRule (lineNode ** shead, lineNode *
stail, peepRule * pr) at line 2149 replace

if (lhead)

with

if (lhead && cl)

rationale : the segfault occurs only when the rule insert a new comment
and no code, which leads to lhead being non-NULL and cl still being NULL at
that point, thus IC-reassociation is attempted and the fourth parameter
passed to reassociate_ic is NULL : KABOOOM!

it should be possible to just check for the non-NULLity of cl but you can
hardly be too careful...



Attached File

No Files Currently Attached

Changes ( 5 )

Field Old Value Date By
status_id Open 2009-08-05 22:03 spth
resolution_id None 2009-08-05 22:03 spth
artifact_group_id None 2009-08-05 22:03 spth
assigned_to nobody 2009-08-05 22:03 spth
close_date - 2009-08-05 22:03 spth