Skip to content

Commit

Permalink
fix Issue 13504 - ICE(backend/cgelem.c 2418) with "-O -cov"
Browse files Browse the repository at this point in the history
- assert failed because goal wasn't properly passed down
  • Loading branch information
MartinNowak committed Oct 7, 2014
1 parent ccca8f3 commit faa0877
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/backend/cgelem.c
Expand Up @@ -2347,13 +2347,13 @@ STATIC elem * eldiv(elem *e, goal_t goal)
* Convert (a op b) op c to a op (b op c).
*/

STATIC elem * swaplog(elem *e)
STATIC elem * swaplog(elem *e, goal_t goal)
{ elem *e1;

e1 = e->E1;
e->E1 = e1->E2;
e1->E2 = e;
return optelem(e1,GOALvalue);
return optelem(e1,goal);
}

STATIC elem * eloror(elem *e, goal_t goal)
Expand Down Expand Up @@ -2386,7 +2386,7 @@ STATIC elem * eloror(elem *e, goal_t goal)
}
if (e1->Eoper == OPoror)
{ /* convert (a||b)||c to a||(b||c). This will find more CSEs. */
return swaplog(e);
return swaplog(e, goal);
}
e2 = elscancommas(e2);
e1 = elscancommas(e1);
Expand Down Expand Up @@ -2723,7 +2723,7 @@ STATIC elem * elandand(elem *e, goal_t goal)
}
if (e1->Eoper == OPandand)
{ /* convert (a&&b)&&c to a&&(b&&c). This will find more CSEs. */
return swaplog(e);
return swaplog(e, goal);
}
e2 = elscancommas(e2);

Expand Down
11 changes: 11 additions & 0 deletions test/runnable/test13504.d
@@ -0,0 +1,11 @@
// REQUIRED_ARGS: -O -cov

bool func(T)()
{
return true;
}

void main()
{
assert(func!int() || int.sizeof);
}

0 comments on commit faa0877

Please sign in to comment.