[Bug c++/86653] New: UBSAN error: cp/parser.c:11760:19: runtime error: load of value 10, which is not a valid value for type 'bool'

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 24 07:49:00 GMT 2018


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

            Bug ID: 86653
           Summary: UBSAN error: cp/parser.c:11760:19: runtime error: load
                    of value 10, which is not a valid value for type
                    'bool'
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org, nathan at gcc dot gnu.org
            Blocks: 63426
  Target Milestone: ---

Following causes UBSAN:

dev/shm/mliska/objdir/gcc/testsuite/g++2/../../xg++
-B/dev/shm/mliska/objdir/gcc/testsuite/g++2/../../
/home/mliska/Programming/gcc/gcc/testsuite/g++.dg/parse/cond8.C
-fno-diagnostics-show-caret -fdiagnostics-color=never -nostdinc++
-I/dev/shm/mliska/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
-I/dev/shm/mliska/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include
-I/home/mliska/Programming/gcc/libstdc++-v3/libsupc++
-I/home/mliska/Programming/gcc/libstdc++-v3/include/backward
-I/home/mliska/Programming/gcc/libstdc++-v3/testsuite/util -fmessage-length=0
-std=c++11 -pedantic-errors -Wno-long-long -S -o cond8.s
/home/mliska/Programming/gcc/gcc/testsuite/g++.dg/parse/cond8.C: In function
‘void foo()’:
/home/mliska/Programming/gcc/gcc/testsuite/g++.dg/parse/cond8.C:5:12: error:
expected initializer before ‘)’ token
/home/mliska/Programming/gcc/gcc/cp/parser.c:11760:19: runtime error: load of
value 10, which is not a valid value for type 'bool'
/home/mliska/Programming/gcc/gcc/testsuite/g++.dg/parse/cond8.C:7:14: error:
expected initializer before ‘;’ token
/home/mliska/Programming/gcc/gcc/testsuite/g++.dg/parse/cond8.C:9:15: error:
expected initializer before ‘)’ token

Proper fix is to initialiaze
bool non_constant_p;

Will be setting that to false OK?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined


More information about the Gcc-bugs mailing list