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

            Bug ID: 106097
           Summary: undefined behaviors regarding integer shifts in
                    loongarch_build_integer
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at mengyan1223 dot wang
  Target Milestone: ---

UBSan reports these undefined behaviors building a cross compiler for
loongarch64-linux-gnu on x86_64-linux-gnu:

/home/xry111/git-repos/gcc-la-build/./gcc/xgcc
-B/home/xry111/git-repos/gcc-la-build/./gcc/ -xc -nostdinc /dev/null -S -o
/dev/null -fself-test=../../gcc/gcc/testsuite/selftests
../../gcc/gcc/config/loongarch/loongarch.cc:1471:49: runtime error: left shift
of 4294967296 by 32 places cannot be represented in type 'long int'
../../gcc/gcc/config/loongarch/loongarch.cc:1520:49: runtime error: left shift
of negative value -524288
../../gcc/gcc/config/loongarch/loongarch.cc:1515:38: runtime error: left shift
of negative value -2048

/home/xry111/git-repos/gcc-la-build/./gcc/xgcc
-B/home/xry111/git-repos/gcc-la-build/./gcc/ -xc++ -nostdinc /dev/null -S -o
/dev/null -fself-test=../../gcc/gcc/testsuite/selftests
../../gcc/gcc/config/loongarch/loongarch.cc:1471:49: runtime error: left shift
of 4294967296 by 32 places cannot be represented in type 'long int'
../../gcc/gcc/config/loongarch/loongarch.cc:1520:49: runtime error: left shift
of negative value -524288
../../gcc/gcc/config/loongarch/loongarch.cc:1515:38: runtime error: left shift
of negative value -2048

Reply via email to