Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Bug 143 - ICE when error message contains embedded format attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jul 21, 2014
1 parent 5bcfb8b commit 553a30c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* d-objfile.cc(output_declaration_p): Don't emit any declarations from
the gcc.attribute module.
(StructDeclaration::toObjFile): Call output_declaration_p.
* d-glue.cc(verror): Only call vasprintf on the initial format string.

2014-07-17 Iain Buclaw <ibuclaw@gdcproject.org>

Expand Down
14 changes: 8 additions & 6 deletions gcc/d/d-glue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,16 @@ verror (Loc loc, const char *format, va_list ap,
char *msg;

// Build string and emit.
if (p2)
format = concat (p2, " ", format, NULL);
if (vasprintf (&msg, format, ap) >= 0 && msg != NULL)
{
if (p2)
msg = concat (p2, " ", msg, NULL);

if (p1)
format = concat (p1, " ", format, NULL);
if (p1)
msg = concat (p1, " ", msg, NULL);

if (vasprintf (&msg, format, ap) >= 0 && msg != NULL)
error_at (location, "%s", msg);
error_at (location, "%s", msg);
}

// Moderate blizzard of cascading messages
if (global.errors >= 20)
Expand Down
1 change: 0 additions & 1 deletion gcc/testsuite/gdc.test/runnable/gdc.d
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ void main()
test131();
test133();
test141();
test142();

printf("Success!\n");
}

0 comments on commit 553a30c

Please sign in to comment.