[RFC] Support for nonzero attribute

Miika nykseli@protonmail.com
Wed Jun 8 20:59:49 GMT 2022


On Wednesday, June 8th, 2022 at 8:42 PM, Eric Gallager <egall@gwmail.gwu.edu> wrote:
> Could you take a look at bug 78155 too? There was a request to add
> something like this in that bug:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78155
> (and I think I've seen similar requests elsewhere, too)

I took a look at the bug and looks like the inrange attribute can be applied to
builtin functions too.

So now the example code
int main (void)
{
    __builtin_printf ("%i\n", __builtin_isalpha (999999));
}

Now gives the following error:

foo.c: In function 'main':
foo.c:3:31: warning: argument in position 1 not in rage of 0..255 [-Winrange]
    3 |     __builtin_printf ("%i\n", __builtin_isalpha (999999));
      |

Miika


More information about the Gcc mailing list