This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/31870] Failure to diagnose taking address of register variable



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]