This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31870] Failure to diagnose taking address of register variable
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 May 2007 15:16:28 -0000
- Subject: [Bug c/31870] Failure to diagnose taking address of register variable
- References: <bug-31870-6@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from bangerth at dealii dot org 2007-05-09 16:16 -------
Uh, can you elaborate? We get the warning you want if we have
int d (void) { register int a[2]; return a; }
instead. In your case, i.e. "return a,1", we return 1, but we still
need evaluate the expression "a". I assume that you mean that this
implies that we have to do the array-to-pointer decay operation. However,
for that case, C99's clause 6.3.2.1/3 says that that's possible for
register storage class arrays but that the result is undefined. The
prohibition in 6.5.3.2/1 against register objects only holds for the
application of the address-of operator "&". Both these clauses are
referenced also from footnote 100 on page 98.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31870