D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5796 - ICE with pragma(msg, ...) after missing ';' in a template
Summary: ICE with pragma(msg, ...) after missing ';' in a template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: Don
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-03-30 08:37 UTC by kennytm
Modified: 2012-01-31 01:09 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2011-03-30 08:37:48 UTC
When a 'pragma(msg, ...)' pragma has a missing comma, the subsequent pragma(msg, ...) will result in a segfault.

------
template A(B) {
    pragma(msg, B)    // <-- missing ';'
    enum A = 0;
}
enum a = A!int;

pragma(msg, 0);
------

The error exists at least since 2.042 http://ideone.com/MVgnG, and still persists in 2.052. The segfault is raised in 'ExpInitializer::semantic' in 'init.c':


Initializer *ExpInitializer::semantic(Scope *sc, Type *t)
{
    //printf("....
    exp = exp->semantic(sc);
    exp = resolveProperties(sc, exp);
    exp = exp->optimize(WANTvalue | WANTinterpret);
    Type *tb = t->toBasetype();                        // <-- this line
Comment 1 github-bugzilla 2012-01-30 23:22:18 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac69d4b9893725d0eb7f40002f73d0b280214b02
Merge pull request #665 from donc/ice5796

ICE bugs 5796 and 6720
Comment 2 github-bugzilla 2012-01-31 01:08:59 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/06b3b85c8f4e069d8a9a6224d155047ba83413c9
fix Issue 5796 - ICE with pragma(msg, ...) after missing ';' in a template