-fsanitize=shift compile error

Mason slash.tmp@free.fr
Tue Sep 27 08:04:00 GMT 2016


On 27/09/2016 01:43, Mateusz Tabaka wrote:

> I'm trying to compile this file:
> int main()
> {
>          int a = 0;
>          switch (a)
>          {
>          case (4 << 29):
>                  break;
>          }
>          return 0;
> }
> 
> and I get this error:
> ./host-x86_64-pc-linux-gnu/gcc/cc1 test.c -quiet -fsanitize=shift
> test.c: In function ‘main’:
> test.c:6:2: error: case label does not reduce to an integer constant
>    case (4 << 29):

Try 4u << 29

Do you get the same error?

Regards.



More information about the Gcc-help mailing list