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

            Bug ID: 91795
           Summary: [UBSAN :- error] with combination of flags (shift and
                    unsigned-integer-overflow)
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akhilesh.k at samsung dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Hello 

I am working on UBSAN. 
When I tried to compile my stack with combination of ubsan checkers I got
"error: void value not ignored as it ought to be"  ERROR. 

Strange.... this error occurred when I use combination of flags (shift and
unsigned-integer-overflow)


I reproduced the same error with below sample test application. 

Please confirm is issue is related with ubsan, 


root@VDBS1454:tmp$ gcc -fsanitize=shift main.c
root@VDBS1454:tmp$ gcc -fsanitize=unsigned-integer-overflow main.c
root@VDBS1454:tmp$ gcc -fsanitize=shift,-fsanitize=unsigned-integer-overflow
main.c
gcc: error: unrecognized argument to -fsanitize= option:
'-fsanitize=unsigned-integer-overflow'
root@VDBS1454:tmp$ gcc -fsanitize=shift, -fsanitize=unsigned-integer-overflow
main.c
main.c: In function 'main':
main.c:5:15: error: void value not ignored as it ought to be
     return (x << 1);
            ~~~^~~~~
root@VDBS1454:tmp$ cat main.c
#include<stdint.h>
unsigned int  main()
{
        uint8_t x;
    return (x << 1);
    //return x*2;

}

root@VDBS1454:tmp$

Reply via email to