public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114627] New: [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c
@ 2024-04-07  9:43 pheeck at gcc dot gnu.org
  2024-04-07  9:43 ` [Bug middle-end/114627] " pheeck at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pheeck at gcc dot gnu.org @ 2024-04-07  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114627
           Summary: [14 Regression] undefined behavior in tree-profile.cc
                    while compiling gcc.misc-tests/gcov-18.c
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: testsuite-fail
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pheeck at gcc dot gnu.org
            Blocks: 63426
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Compiling gcc.misc-tests/gcov-19.c using ubsan-instrumented GCC

gcc testsuite/gcc.misc-tests/gcov-19.c -fdiagnostics-plain-output
-fcondition-coverage -ftest-coverage -lm -o ./gcov-19.exe

results in

/home/worker/buildworker/tiber-gcc-ubsan/build/gcc/tree-profile.cc:1090:48:
runtime error: shift exponent 64 is too large for 64-bit type 'long long
unsigned int'

Compiler configured with
--enable-languages=default,jit,lto,go,d --enable-host-shared
--enable-checking=release --disable-multilib
--with-build-config=bootstrap-ubsan


Referenced Bugs:

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114627] [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c
  2024-04-07  9:43 [Bug middle-end/114627] New: [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c pheeck at gcc dot gnu.org
@ 2024-04-07  9:43 ` pheeck at gcc dot gnu.org
  2024-04-08  8:45 ` [Bug middle-end/114627] " rguenth at gcc dot gnu.org
  2024-04-09  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pheeck at gcc dot gnu.org @ 2024-04-07  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Filip Kastl <pheeck at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114627] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c
  2024-04-07  9:43 [Bug middle-end/114627] New: [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c pheeck at gcc dot gnu.org
  2024-04-07  9:43 ` [Bug middle-end/114627] " pheeck at gcc dot gnu.org
@ 2024-04-08  8:45 ` rguenth at gcc dot gnu.org
  2024-04-09  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-04-08  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regression] undefined   |undefined behavior in
                   |behavior in tree-profile.cc |tree-profile.cc while
                   |while compiling             |compiling
                   |gcc.misc-tests/gcov-18.c    |gcc.misc-tests/gcov-18.c
   Target Milestone|14.0                        |---

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
it's not a regression from older GCC since -fcondition-coverage is new

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114627] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c
  2024-04-07  9:43 [Bug middle-end/114627] New: [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c pheeck at gcc dot gnu.org
  2024-04-07  9:43 ` [Bug middle-end/114627] " pheeck at gcc dot gnu.org
  2024-04-08  8:45 ` [Bug middle-end/114627] " rguenth at gcc dot gnu.org
@ 2024-04-09  7:58 ` cvs-commit at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-09  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by J?rgen Kvalsvik <jkv@gcc.gnu.org>:

https://gcc.gnu.org/g:a2447556a5405d2cde20afc134b90cd1d199ce04

commit r14-9864-ga2447556a5405d2cde20afc134b90cd1d199ce04
Author: Jørgen Kvalsvik <j@lambda.is>
Date:   Mon Apr 8 15:19:55 2024 +0200

    Generate constant at start of loop, without UB

    Generating the constants used for recording the edges taken for
    condition coverage would trigger undefined behavior when an expression
    had exactly 64 (== sizeof (1ULL)) conditions, as it would generate the
    constant for the next iteration at the end of the loop body, even if there
    was never a next iteration. By moving the check and constant generation
    to the top of the loop and hoisting the increment flag there is no
    opportunity for UB.

            PR middle-end/114627

    gcc/ChangeLog:

            * tree-profile.cc (instrument_decisions): Generate constant
            at the start of loop.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-09  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-07  9:43 [Bug middle-end/114627] New: [14 Regression] undefined behavior in tree-profile.cc while compiling gcc.misc-tests/gcov-18.c pheeck at gcc dot gnu.org
2024-04-07  9:43 ` [Bug middle-end/114627] " pheeck at gcc dot gnu.org
2024-04-08  8:45 ` [Bug middle-end/114627] " rguenth at gcc dot gnu.org
2024-04-09  7:58 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).