[Bug c/87868] New: testsuite/c-c++-common/pr60101.c with -O3 and ubsan

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Fri Nov 2 18:10:00 GMT 2018


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

            Bug ID: 87868
           Summary: testsuite/c-c++-common/pr60101.c with -O3 and ubsan
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Compiling -c++-common/pr60101.c from the gcc/testsuite with
flag -O3 on a recent version of ubsan gcc trunk does this:

$ ~/gcc/results.265631.ubsan/bin/gcc -c -g -O3 ./c-c++-common/pr60101.c
../../trunk/gcc/postreload-gcse.c:1174:45: runtime error: signed integer
overflow: 10 * 2304690102552494078 cannot be represented in type 'long int'

Interestingly, no problem with -O2:

$ ~/gcc/results.265631.ubsan/bin/gcc -c -g -O2 ./c-c++-common/pr60101.c
$ 

postreload-gcse.c source code is

  if (ok_count.to_gcov_type ()
      < GCSE_AFTER_RELOAD_CRITICAL_FRACTION * critical_count.to_gcov_type ())
    goto cleanup;

and svn blame says

248863    hubicka   if (ok_count.to_gcov_type ()
248863    hubicka       < GCSE_AFTER_RELOAD_CRITICAL_FRACTION *
critical_count.to_gcov_type ())


More information about the Gcc-bugs mailing list