------- Comment #2 from neil at daikokuya dot co dot uk 2007-05-09 23:39 ------- Subject: Re: Failure to diagnose taking address of register variable
bangerth at dealii dot org wrote:- > 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, Yes, it has to be done. > 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. Right. GCC seems to want to diagnose this undefined behaviour; it does in all other circumstances. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31870