public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104525] New: timeout on signed overflow at O0 fwrapv
@ 2022-02-14  8:09 guojiufu at gcc dot gnu.org
  2022-02-14  8:29 ` [Bug target/104525] " guojiufu at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2022-02-14  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104525
           Summary: timeout on signed overflow at O0 fwrapv
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guojiufu at gcc dot gnu.org
  Target Milestone: ---

When checking the case in PR104521, a timeout occurs on the case at ppc64le.
The timeout also occurs with -O0 -fwrapv (without -fwrapv, the signed overflow
which would be a UB). This issue seems to exist for a long time (gcc6).

> cat small.c
char a, b, c;
int main() {
  unsigned char d = 1;
  while (1) {
    if (c >= a) {
      for (c = 0; c != -4; c -= 3) {
        while (!d)
          b = 0;
        continue;
      }
    }
    d = ~a;
    if (!d)
      continue;
    return 0;
  }
}

> gcc -fwrapv -O0  small.c ; timeout -s 9 5 ./a.out
Killed

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

* [Bug target/104525] timeout on signed overflow at O0 fwrapv
  2022-02-14  8:09 [Bug target/104525] New: timeout on signed overflow at O0 fwrapv guojiufu at gcc dot gnu.org
@ 2022-02-14  8:29 ` guojiufu at gcc dot gnu.org
  2022-02-14  8:33 ` pinskia at gcc dot gnu.org
  2022-02-14 10:30 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2022-02-14  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
with "-fsigned-char", the case run ok. 
When 'char' is treated as 'unsigned': "c != -4" would not be true is any value
of 'c'.
So, this PR would be invalid.

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

* [Bug target/104525] timeout on signed overflow at O0 fwrapv
  2022-02-14  8:09 [Bug target/104525] New: timeout on signed overflow at O0 fwrapv guojiufu at gcc dot gnu.org
  2022-02-14  8:29 ` [Bug target/104525] " guojiufu at gcc dot gnu.org
@ 2022-02-14  8:33 ` pinskia at gcc dot gnu.org
  2022-02-14 10:30 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-14  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes on PowerPC (and ARM and aarch64), plain char is unsigned by default.

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

* [Bug target/104525] timeout on signed overflow at O0 fwrapv
  2022-02-14  8:09 [Bug target/104525] New: timeout on signed overflow at O0 fwrapv guojiufu at gcc dot gnu.org
  2022-02-14  8:29 ` [Bug target/104525] " guojiufu at gcc dot gnu.org
  2022-02-14  8:33 ` pinskia at gcc dot gnu.org
@ 2022-02-14 10:30 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-14 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And on -fsigned-char targets, -fwrapv isn't needed, there isn't signed integer
overflow, because c -= 3 promotes to int, so it is actually
c = (signed char) ((int) c - 3)

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

end of thread, other threads:[~2022-02-14 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14  8:09 [Bug target/104525] New: timeout on signed overflow at O0 fwrapv guojiufu at gcc dot gnu.org
2022-02-14  8:29 ` [Bug target/104525] " guojiufu at gcc dot gnu.org
2022-02-14  8:33 ` pinskia at gcc dot gnu.org
2022-02-14 10:30 ` 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).