re PR middle-end/18160 (ICE on taking register variable address)

PR middle-end/18160
	* typeck.c (cxx_mark_addressable): Issue an error if address of an
	explicit register variable is requested.

From-SVN: r90452
This commit is contained in:
Adam Nemet 2004-11-10 21:09:25 +00:00 committed by Adam Nemet
parent 7299dbfbf1
commit 1b8d7c9a2f
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2004-11-10 Adam Nemet <anemet@lnxw.com>
PR middle-end/18160
* typeck.c (cxx_mark_addressable): Issue an error if address of an
explicit register variable is requested.
2004-11-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18143

View File

@ -4343,9 +4343,16 @@ cxx_mark_addressable (tree exp)
case CONST_DECL:
case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x) && extra_warnings)
warning ("address requested for %qD, which is declared %<register%>",
x);
&& !DECL_ARTIFICIAL (x))
if (DECL_HARD_REGISTER (x) != 0)
{
error
("address of explicit register variable %qD requested", x);
return false;
}
else if (extra_warnings)
warning
("address requested for %qD, which is declared %<register%>", x);
TREE_ADDRESSABLE (x) = 1;
return true;