public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/99236] New: Undefined behaviour in libgcc
@ 2021-02-24  7:15 zeccav at gmail dot com
  2021-02-24 12:34 ` [Bug libgcc/99236] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zeccav at gmail dot com @ 2021-02-24  7:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99236
           Summary: Undefined behaviour in libgcc
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com
  Target Milestone: ---

! must be compiled and run
! It does not need sanitized compiler, but
! must be loaded with sanitized version of libgcc_s.so.1
! ldd a.out -> libgcc_s.so.1 =>
/home/vitti/local/gcc-150221-undefined/lib64/libgcc_s.so.1
!../../../gcc-150221/libgcc/libgcc2.c:1837:31: runtime error: negation of
-2147483648 cannot be represented in type 'int'; cast to an unsigned type to
negate this value to itself
! libgcc2.c:1837 -> "unsigned int n = m < 0 ? -m : m;"
      a = 3.0
      b = a**(-2147483647_4-1_4)
      end

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

* [Bug libgcc/99236] Undefined behaviour in libgcc
  2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
@ 2021-02-24 12:34 ` jakub at gcc dot gnu.org
  2021-02-24 12:37 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-24 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-02-24
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
                 CC|                            |jakub at gcc dot gnu.org

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

* [Bug libgcc/99236] Undefined behaviour in libgcc
  2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
  2021-02-24 12:34 ` [Bug libgcc/99236] " jakub at gcc dot gnu.org
@ 2021-02-24 12:37 ` jakub at gcc dot gnu.org
  2021-02-24 13:52 ` zeccav at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-24 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50246
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50246&action=edit
gcc11-pr99236.patch

Untested fix.

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

* [Bug libgcc/99236] Undefined behaviour in libgcc
  2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
  2021-02-24 12:34 ` [Bug libgcc/99236] " jakub at gcc dot gnu.org
  2021-02-24 12:37 ` jakub at gcc dot gnu.org
@ 2021-02-24 13:52 ` zeccav at gmail dot com
  2021-02-24 19:09 ` cvs-commit at gcc dot gnu.org
  2021-02-24 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: zeccav at gmail dot com @ 2021-02-24 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Vittorio Zecca <zeccav at gmail dot com> ---
After patching libgcc2.c the test case runs fine without sanitizer messages.

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

* [Bug libgcc/99236] Undefined behaviour in libgcc
  2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2021-02-24 13:52 ` zeccav at gmail dot com
@ 2021-02-24 19:09 ` cvs-commit at gcc dot gnu.org
  2021-02-24 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-24 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:35da095d7e0614235cb0e241685c5e1a240dc882

commit r11-7374-g35da095d7e0614235cb0e241685c5e1a240dc882
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 24 20:07:38 2021 +0100

    libgcc: Avoid signed negation overflow in __powi?f2 [PR99236]

    When these functions are called with integer minimum, there is UB on the
libgcc
    side.  Fixed in the obvious way, the code in the end wants ABSU_EXPR
behavior.

    2021-02-24  Jakub Jelinek  <jakub@redhat.com>

            PR libgcc/99236
            * libgcc2.c (__powisf2, __powidf2, __powitf2, __powixf2): Perform
            negation of m in unsigned type.

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

* [Bug libgcc/99236] Undefined behaviour in libgcc
  2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
                   ` (3 preceding siblings ...)
  2021-02-24 19:09 ` cvs-commit at gcc dot gnu.org
@ 2021-02-24 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-24 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed in GCC 11, IMHO not worth backporting.

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

end of thread, other threads:[~2021-02-24 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24  7:15 [Bug libgcc/99236] New: Undefined behaviour in libgcc zeccav at gmail dot com
2021-02-24 12:34 ` [Bug libgcc/99236] " jakub at gcc dot gnu.org
2021-02-24 12:37 ` jakub at gcc dot gnu.org
2021-02-24 13:52 ` zeccav at gmail dot com
2021-02-24 19:09 ` cvs-commit at gcc dot gnu.org
2021-02-24 19:16 ` jakub 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).