D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4926 - ICE: PREC_zero assertion failure due to unset precedence
Summary: ICE: PREC_zero assertion failure due to unset precedence
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: patch
: 4912 4914 4950 4981 5087 (view as issue list)
Depends on:
Blocks:
 
Reported: 2010-09-23 13:54 UTC by Shin Fujishiro
Modified: 2015-06-09 05:11 UTC (History)
6 users (show)

See Also:


Attachments
Patch against dmd r685, sets missing precedences (3.11 KB, patch)
2010-09-23 13:54 UTC, Shin Fujishiro
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010-09-23 13:54:58 UTC
Created attachment 767 [details]
Patch against dmd r685, sets missing precedences

Precedences for the following TOKs are not set, while they can be referenced by
expToCBuffer().

 TOKassocarrayliteral, TOKcomplex80, TOKdelegate, TOKdotexp,
 TOKdottype, TOKdsymbol, TOKfile, TOKhalt, TOKline,
 TOKnewanonclass, TOKoverloadset, TOKremove, TOKtemplate.

This causes PREC_zero assertion failures in expToCBuffer(). The following cases
all trigger the assertion failure.
--------------------
template Q(s...) { alias s q; }
class C {}
enum assocarrayliteral = Q!( [1:2] ).q.stringof;
enum complex80 = Q!( 1+1.0i ).q.stringof;
enum dottype = Q!( C.Object.toString ).q.stringof;
enum halt = (assert(0), 0).stringof;    // ICE w/ -release
enum remove = Q!( [1:2].remove(1) ).q.stringof;
enum templat = Q!( Q ).q.stringof;
--------------------
The halt case depends on bug 4925. dottype and remove are ice-on-invalid.

Although I couldn't find any offending case for the other TOKs, I think it's
better to define reasonable precedences for all the said TOKs.

The attached patch also fixes bug 4912 and bug 4914.
Comment 1 Shin Fujishiro 2010-09-23 14:01:53 UTC
*** Issue 4912 has been marked as a duplicate of this issue. ***
Comment 2 Don 2010-09-23 23:57:00 UTC
This is a regression introduced in 2.049, and it also applies to D1 (need to replace 'enum' with 'const' for the D1 test case).
Comment 3 Juanjo Alvarez 2010-09-27 13:25:54 UTC
*** Issue 4950 has been marked as a duplicate of this issue. ***
Comment 4 Walter Bright 2010-09-27 17:42:32 UTC
http://www.dsource.org/projects/dmd/changeset/694
Comment 5 Don 2010-10-07 07:25:11 UTC
*** Issue 4981 has been marked as a duplicate of this issue. ***
Comment 6 Don 2010-10-07 07:26:31 UTC
*** Issue 4914 has been marked as a duplicate of this issue. ***
Comment 7 Don 2010-10-20 11:55:39 UTC
*** Issue 5087 has been marked as a duplicate of this issue. ***