Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000145 [cparser] firm graph generation crash always 2014-07-23 12:00 2016-01-03 03:28
Reporter haass View Status public  
Assigned To Matze
Priority low Resolution unable to reproduce  
Status closed   Product Version 0.9.14
Summary 0000145: bad use of globals crashes libFirm
Description by calling ir_init() the global irp gets half initialized.

new_ir_prog() finishes the initialization of the global irp (as a side-effect) and returns a half initialized local irp.

Following the API docs, using set_irp() or assigning the global irp leaves libfirm with a half initialized irp that crashes at ir_finish()

also, because the global irp is almost initialized by ir_init(), why bother to call new_ir_prog() at all? This should not be possible, if types and entities need to be prepared before an irp exists (firm.c:Note: 0000071), then they don't belong to the irp but to the firm-instance

The tutorial shows a working solution, it calls new_ir_prog() and throws away(!) the result, ending with a completely initialized global irp and breaking consistency with every other new_* method of libfirm (and the api docs)
Additional Information example attached
Tags No tags attached.
Attached Files tgz file icon bug_global_irp.tgz [^] (1,259 bytes) 2014-07-23 12:00

- Relationships

-  Notes
Matze (administrator)
2014-07-25 14:32

the attached example does not crash for me and also shows no problems in valgrind...

Looking through the code I could only find a minor issue fixed in revision 5838e0b6362add4650f95b1ea8202576fdcc7a30 not sure if that is what you were hitting.

BTW: I removed the completely pointless call to new_ir_prog() from the tutorial there are few reasons why you would not just use the default ir_prog anyway...
haass (reporter)
2014-08-19 11:38

Yes, 5838e0b6362add4650f95b1ea8202576fdcc7a30 fixes the problem.
Sorry, must have tested the bug on the wrong branch!

- Issue History
Date Modified Username Field Change
2014-07-23 12:00 haass New Issue
2014-07-23 12:00 haass File Added: bug_global_irp.tgz
2014-07-23 12:01 ansel Issue Monitored: ansel
2014-07-25 14:32 Matze Note Added: 0000219
2014-07-25 14:32 Matze Assigned To => Matze
2014-07-25 14:32 Matze Priority normal => low
2014-07-25 14:32 Matze Status new => feedback
2014-07-25 14:32 Matze Resolution open => unable to reproduce
2014-08-19 11:38 haass Note Added: 0000220
2014-08-19 11:46 Matze Status feedback => resolved
2016-01-03 03:28 Matze Status resolved => closed

Mantis 1.1.5[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker