public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110427] New: a<a-- will be satisfied in gcc 9 and gcc 11
@ 2023-06-27  7:49 qurong at ios dot ac.cn
  2023-06-27  8:02 ` [Bug c/110427] " arsen at gcc dot gnu.org
  2023-06-27  8:14 ` schwab@linux-m68k.org
  0 siblings, 2 replies; 3+ messages in thread
From: qurong at ios dot ac.cn @ 2023-06-27  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110427
           Summary: a<a-- will be satisfied in gcc 9 and gcc 11
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qurong at ios dot ac.cn
  Target Milestone: ---

The output of the following c program is 1 in gcc while it is -1 in clang,
Maybe -1 is the expected output for this program.
#include <stdio.h> 
int main() {
        int a = 0;
        if (a < a--) {
                a = 1;
        }
        printf("%d\n", a);
        return 0;
}

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

* [Bug c/110427] a<a-- will be satisfied in gcc 9 and gcc 11
  2023-06-27  7:49 [Bug c/110427] New: a<a-- will be satisfied in gcc 9 and gcc 11 qurong at ios dot ac.cn
@ 2023-06-27  8:02 ` arsen at gcc dot gnu.org
  2023-06-27  8:14 ` schwab@linux-m68k.org
  1 sibling, 0 replies; 3+ messages in thread
From: arsen at gcc dot gnu.org @ 2023-06-27  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

Arsen Arsenović <arsen at gcc dot gnu.org> changed:

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

--- Comment #1 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
<source>: In function 'main':
<source>:4:18: warning: operation on 'a' may be undefined [-Wsequence-point]
    4 |         if (a < a--) {
      |                 ~^~

the result is simply undefined (is the first `a' pre- or post-decrement?)

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

* [Bug c/110427] a<a-- will be satisfied in gcc 9 and gcc 11
  2023-06-27  7:49 [Bug c/110427] New: a<a-- will be satisfied in gcc 9 and gcc 11 qurong at ios dot ac.cn
  2023-06-27  8:02 ` [Bug c/110427] " arsen at gcc dot gnu.org
@ 2023-06-27  8:14 ` schwab@linux-m68k.org
  1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2023-06-27  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

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

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
The behaviour is undefined.

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

end of thread, other threads:[~2023-06-27  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27  7:49 [Bug c/110427] New: a<a-- will be satisfied in gcc 9 and gcc 11 qurong at ios dot ac.cn
2023-06-27  8:02 ` [Bug c/110427] " arsen at gcc dot gnu.org
2023-06-27  8:14 ` schwab@linux-m68k.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).