public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators
@ 2004-10-18 13:47 veksler at il dot ibm dot com
  2004-10-18 14:06 ` [Bug c++/18047] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: veksler at il dot ibm dot com @ 2004-10-18 13:47 UTC (permalink / raw)
  To: gcc-bugs

gcc-4.0 gives operator== higher precedence than operator<, which is against
5.10 paragraph 1:
  "Note: a<b == c<d is true whenever a<b and c<d have the same truth value"

$ cat t.cpp
int main()
{
   if ( 2 < 0 == false)
       return 0;  // should return here
   return 1;
}

$ /home/veksler/gcc-4.0-20041017/bin/g++ t.cpp
$ ./a.out ; echo status=$?
status=1

-- 
           Summary: Wrong precedence between equality (==, !=) and <
                    operators
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: veksler at il dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
@ 2004-10-18 14:06 ` pinskia at gcc dot gnu dot org
  2004-10-18 15:02 ` zack at codesourcery dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-18 14:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-18 14:06 -------
Confirmed, the regression showed up on 2004-09-23 (between 01:40:01 and 16:10:02 EST/EDT).
Since this effects only the C++ front-end, the patch which looks the most likely is:
2004-09-23  Zack Weinberg  <zack@codesourcery.com>

        * decl.c (grokfndecl): If ::main is found not to return int,
        correct it after issuing a diagnostic.
        (grokdeclarator): If the incoming type was error_mark_node, do
        not complain about declaring something with no type.
        (start_function): Change check for ::main not returning int to
        an assertion, as grokfndecl now catches this when the user did it.
        * init.c (perform_member_init, sort_mem_initializers)
        (emit_mem_initializers): Make most diagnostics be issued on
        the line of current_function_decl, not whatever the current
        input line is.
        .....



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zack at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-18 14:06:18
               date|                            |
            Summary|Wrong precedence between    |[4.0 Regression] Wrong
                   |equality (==, !=) and <     |precedence between equality
                   |operators                   |(==, !=) and < operators
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
  2004-10-18 14:06 ` [Bug c++/18047] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-10-18 15:02 ` zack at codesourcery dot com
  2004-10-18 15:50 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zack at codesourcery dot com @ 2004-10-18 15:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2004-10-18 15:02 -------
Subject: Re:  [4.0 Regression] Wrong precedence between equality (==, !=) and < operators


I doubt that.  I'd be inclined to point fingers at the
operator-precedence parser patch, myself.

zw


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
  2004-10-18 14:06 ` [Bug c++/18047] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-10-18 15:02 ` zack at codesourcery dot com
@ 2004-10-18 15:50 ` bangerth at dealii dot org
  2004-10-18 18:36 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-10-18 15:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-10-18 15:50 -------
Well, in any case it's definitely a critical regression! 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
                   ` (2 preceding siblings ...)
  2004-10-18 15:50 ` bangerth at dealii dot org
@ 2004-10-18 18:36 ` pinskia at gcc dot gnu dot org
  2004-10-19  7:35 ` bonzini at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-18 18:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-18 18:36 -------
Paolo since now I have been convinced that your patch caused this regression, could you look into it?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
                   ` (3 preceding siblings ...)
  2004-10-18 18:36 ` pinskia at gcc dot gnu dot org
@ 2004-10-19  7:35 ` bonzini at gcc dot gnu dot org
  2004-10-19  7:42 ` bonzini at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2004-10-19  7:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-10-18 14:06:18         |2004-10-19 07:35:57
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
                   ` (4 preceding siblings ...)
  2004-10-19  7:35 ` bonzini at gcc dot gnu dot org
@ 2004-10-19  7:42 ` bonzini at gcc dot gnu dot org
  2004-10-19 12:41 ` cvs-commit at gcc dot gnu dot org
  2004-10-19 12:43 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2004-10-19  7:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2004-10-19 07:42 -------
The fix is obvious, I misordered the two precedence in enum cp_parser_prec. 
I'll commit it and add a testcase.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
                   ` (5 preceding siblings ...)
  2004-10-19  7:42 ` bonzini at gcc dot gnu dot org
@ 2004-10-19 12:41 ` cvs-commit at gcc dot gnu dot org
  2004-10-19 12:43 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-19 12:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-19 12:40 -------
Subject: Bug 18047

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2004-10-19 12:40:32

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: expr3.C 

Log message:
	2004-10-19  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c++/18047
	* parser.c (enum cp_parser_prec): Give relational expressions
	a higher precedence than equality expressions.
	
	2004-10-19  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c++/18047
	
	* g++.dg/parse/expr3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4442&r2=1.4443
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.265&r2=1.266
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4473&r2=1.4474
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/expr3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

* [Bug c++/18047] [4.0 Regression] Wrong precedence between equality (==, !=) and < operators
  2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
                   ` (6 preceding siblings ...)
  2004-10-19 12:41 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-19 12:43 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2004-10-19 12:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2004-10-19 12:43 -------
Fixed by the above patch.

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18047


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

end of thread, other threads:[~2004-10-19 12:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-18 13:47 [Bug c++/18047] New: Wrong precedence between equality (==, !=) and < operators veksler at il dot ibm dot com
2004-10-18 14:06 ` [Bug c++/18047] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-18 15:02 ` zack at codesourcery dot com
2004-10-18 15:50 ` bangerth at dealii dot org
2004-10-18 18:36 ` pinskia at gcc dot gnu dot org
2004-10-19  7:35 ` bonzini at gcc dot gnu dot org
2004-10-19  7:42 ` bonzini at gcc dot gnu dot org
2004-10-19 12:41 ` cvs-commit at gcc dot gnu dot org
2004-10-19 12:43 ` bonzini at gcc dot gnu dot 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).