7568 – pragma(msg) segfaults with an aggregate including a class.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7568 - pragma(msg) segfaults with an aggregate including a class.
Summary: pragma(msg) segfaults with an aggregate including a class.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: CTFE, ice
Depends on:
Blocks:
Reported: 2012年02月23日 11:02 UTC by kennytm
Modified: 2012年02月29日 23:35 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2012年02月23日 11:02:13 UTC
Test cases:
-----------------------------------------------
class C7568 {}
struct S7568 { C7568 c; }
auto test7568a() { return [new C7568]; }
auto test7568b() { return S7568(new C7568); }
pragma(msg, test7568a());
pragma(msg, test7568b());
-----------------------------------------------
This will cause a segmentation fault:
 test.d(4): Error: C7568 class literals cannot be returned from CTFE
 Segmentation fault
This happens because an Expression* is assigned to the value 0x1, and the function 'argsToCBuffer' is trying to access the expression without first checking if the expression is a valid pointer.
The program should simply fail to compile, without the segfault.
Comment 1 Walter Bright 2012年02月29日 19:15:25 UTC
https://github.com/D-Programming-Language/dmd/pull/774 
Comment 2 github-bugzilla 2012年02月29日 23:35:04 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/8fadb858512dda3f2c697a6b55bb5d2369c18995
fix Issue 7568 - pragma(msg) segfaults with an aggregate including a class.


AltStyle によって変換されたページ (->オリジナル) /