https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #17)
> See integral_argument in gcc/opts-common.cc:
> 
>     181 HOST_WIDE_INT
>     182 integral_argument (const char *arg, int *err, bool byte_size_suffix)
>     183 {
>     184   if (!err)
>     185     err = &errno;
>     186 
>     187   if (!ISDIGIT (*arg))
>     188     {
>     189       *err = EINVAL;
>     190       return -1;
>     191     }
>     192 
>     193   *err = 0;
>     194   errno = 0;

ICK.

> I agree it's rare, but it's not entirely unheard of.

Makes me think of a possible -fdirect-errno-only?  It might be possible to
diagnose address-taking of it.  It would still require marking of errno
accesses, of course.

Marking of errno accesses could also try to DWIM, avoid optimizing
known-errno accesses but still optimize the maybe-errno cases.
I'm not entirely sure how the frontend can effectively check for the
possible pp token (which has to be 'errno') after macro-expansion.

Reply via email to