public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41131]  New: non-lvalue in unary `&' wrongly accepted
@ 2009-08-20 15:12 sergei_lus at yahoo dot com
  2009-08-20 19:07 ` [Bug c++/41131] " jakub at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sergei_lus at yahoo dot com @ 2009-08-20 15:12 UTC (permalink / raw)
  To: gcc-bugs

According to the iso 14882:1998 5.2.5 Class member access, the following code:

class X {
public:
        enum enumX { a=100 };
};
int main(void)
{
        X x;
        (void) &x.a;    // should not compile
        return  1;
}

should not compile, but with the following version of g++:
g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix
--prefix=/prj/dsp/qdsp6_aus/users/slarin/x86_gcc_4.4/bin
--enable-languages=c,c++ --disable-checking
Thread model: posix
gcc version 4.4.0 (GCC)

... it does. Also failing in 4.3.2. In 3.3.3 and 3.4.6 for example it correctly
reports the following:

g++ reduced.c
reduced.c: In function `int main()':
reduced.c:11: error: non-lvalue in unary `&'


Thank you.


-- 
           Summary: non-lvalue in unary `&' wrongly accepted
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sergei_lus at yahoo dot com


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


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

* [Bug c++/41131] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
@ 2009-08-20 19:07 ` jakub at gcc dot gnu dot org
  2009-08-20 19:09 ` [Bug c++/41131] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-20 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-08-20 19:07 -------
This got broken by
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02640.html
(the lvalue_p_1 change to handle CONST_DECL).  Unfortunately the patch didn't
have any comments why has that been necessary.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
  2009-08-20 19:07 ` [Bug c++/41131] " jakub at gcc dot gnu dot org
@ 2009-08-20 19:09 ` pinskia at gcc dot gnu dot org
  2009-08-20 19:26 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-08-20 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-08-20 19:09 -------
(In reply to comment #1)
> This got broken by
> http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02640.html
> (the lvalue_p_1 change to handle CONST_DECL).  Unfortunately the patch didn't
> have any comments why has that been necessary.

Hmm, most likely because @"" strings are CONST_DECLS ... Which case this might
be my issue as I changed them but ...


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |accepts-invalid
      Known to fail|                            |4.3.0 4.4.0 4.5.0
      Known to work|                            |3.4.6
            Summary|non-lvalue in unary `&'     |[4.3/4.4/4.5 Regression]
                   |wrongly accepted            |non-lvalue in unary `&'
                   |                            |wrongly accepted
   Target Milestone|---                         |4.3.5


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
  2009-08-20 19:07 ` [Bug c++/41131] " jakub at gcc dot gnu dot org
  2009-08-20 19:09 ` [Bug c++/41131] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2009-08-20 19:26 ` jakub at gcc dot gnu dot org
  2009-08-20 22:03 ` jason at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-20 19:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-08-20 19:26 -------
Created an attachment (id=18407)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18407&action=view)
gcc45-pr41131.patch

I guess objc_build_string_object is the reason, except for that function
CONST_DECLs are only used for enumeration values in C/C++/ObjC/ObjC++.  And
that function creates a CONST_DECL and builds ADDR_EXPR on it, thus without
that lvalue_p_1 change I guess it would die with error.
Fortunately this CONST_DECL has TREE_STATIC set, while enumeration vals don't.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (2 preceding siblings ...)
  2009-08-20 19:26 ` jakub at gcc dot gnu dot org
@ 2009-08-20 22:03 ` jason at gcc dot gnu dot org
  2009-08-20 22:04 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-08-20 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2009-08-20 22:03 -------
Pinski: You made TREE_STATIC CONST_DECLs? Why?


-- 


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (3 preceding siblings ...)
  2009-08-20 22:03 ` jason at gcc dot gnu dot org
@ 2009-08-20 22:04 ` pinskia at gcc dot gnu dot org
  2009-08-21  7:08 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-08-20 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-08-20 22:04 -------
(In reply to comment #4)
> Pinski: You made TREE_STATIC CONST_DECLs? Why?

The Fortran front-end did that before I did it ... (RTH did that).


-- 


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (4 preceding siblings ...)
  2009-08-20 22:04 ` pinskia at gcc dot gnu dot org
@ 2009-08-21  7:08 ` jakub at gcc dot gnu dot org
  2009-08-21  7:11 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-21  7:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-08-21 07:08 -------
Subject: Bug 41131

Author: jakub
Date: Fri Aug 21 07:08:15 2009
New Revision: 150985

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150985
Log:
        PR c++/41131
        * tree.c (lvalue_p_1) <case CONST_DECL>: Return clk_none if
        not TREE_STATIC.

        * g++.dg/expr/unary3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/expr/unary3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/41131] [4.3/4.4/4.5 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (5 preceding siblings ...)
  2009-08-21  7:08 ` jakub at gcc dot gnu dot org
@ 2009-08-21  7:11 ` jakub at gcc dot gnu dot org
  2009-08-21  7:24 ` [Bug c++/41131] [4.3 " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-21  7:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2009-08-21 07:10 -------
Subject: Bug 41131

Author: jakub
Date: Fri Aug 21 07:10:36 2009
New Revision: 150986

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150986
Log:
        PR c++/41131
        * tree.c (lvalue_p_1) <case CONST_DECL>: Return clk_none if
        not TREE_STATIC.

        * g++.dg/expr/unary3.C: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/expr/unary3.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/tree.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/41131] [4.3 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (6 preceding siblings ...)
  2009-08-21  7:11 ` jakub at gcc dot gnu dot org
@ 2009-08-21  7:24 ` jakub at gcc dot gnu dot org
  2009-08-21 18:17 ` sergei_lus at yahoo dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-21  7:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-08-21 07:23 -------
Fixed for 4.4/4.5 so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |UNCONFIRMED
      Known to fail|4.3.0 4.4.0 4.5.0           |4.3.0 4.4.0
      Known to work|3.4.6                       |3.4.6 4.4.2 4.5.0
            Summary|[4.3/4.4/4.5 Regression]    |[4.3 Regression] non-lvalue
                   |non-lvalue in unary `&'     |in unary `&' wrongly
                   |wrongly accepted            |accepted


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


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

* [Bug c++/41131] [4.3 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (7 preceding siblings ...)
  2009-08-21  7:24 ` [Bug c++/41131] [4.3 " jakub at gcc dot gnu dot org
@ 2009-08-21 18:17 ` sergei_lus at yahoo dot com
  2009-08-25 13:39 ` bangerth at gmail dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sergei_lus at yahoo dot com @ 2009-08-21 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from sergei_lus at yahoo dot com  2009-08-21 18:17 -------

This patch works for me. Thanks. 


-- 


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


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

* [Bug c++/41131] [4.3 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (8 preceding siblings ...)
  2009-08-21 18:17 ` sergei_lus at yahoo dot com
@ 2009-08-25 13:39 ` bangerth at gmail dot com
  2009-08-31 16:46 ` jakub at gcc dot gnu dot org
  2010-01-02 16:25 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at gmail dot com @ 2009-08-25 13:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from bangerth at gmail dot com  2009-08-25 13:39 -------
Was already confirmed.


-- 

bangerth at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at gmail dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-25 13:39:12
               date|                            |


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


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

* [Bug c++/41131] [4.3 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (9 preceding siblings ...)
  2009-08-25 13:39 ` bangerth at gmail dot com
@ 2009-08-31 16:46 ` jakub at gcc dot gnu dot org
  2010-01-02 16:25 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-31 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2009-08-31 16:45 -------
*** Bug 40224 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/41131] [4.3 Regression] non-lvalue in unary `&' wrongly accepted
  2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
                   ` (10 preceding siblings ...)
  2009-08-31 16:46 ` jakub at gcc dot gnu dot org
@ 2010-01-02 16:25 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-02 16:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenth at gcc dot gnu dot org  2010-01-02 16:25 -------
Wontfix on the 4.3 branch, we usually do not backport accepts-invalid fixes.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.3.0 4.4.0                 |4.3.4 4.4.1
         Resolution|                            |FIXED
   Target Milestone|4.3.5                       |4.4.2


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


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

end of thread, other threads:[~2010-01-02 16:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-20 15:12 [Bug c++/41131] New: non-lvalue in unary `&' wrongly accepted sergei_lus at yahoo dot com
2009-08-20 19:07 ` [Bug c++/41131] " jakub at gcc dot gnu dot org
2009-08-20 19:09 ` [Bug c++/41131] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
2009-08-20 19:26 ` jakub at gcc dot gnu dot org
2009-08-20 22:03 ` jason at gcc dot gnu dot org
2009-08-20 22:04 ` pinskia at gcc dot gnu dot org
2009-08-21  7:08 ` jakub at gcc dot gnu dot org
2009-08-21  7:11 ` jakub at gcc dot gnu dot org
2009-08-21  7:24 ` [Bug c++/41131] [4.3 " jakub at gcc dot gnu dot org
2009-08-21 18:17 ` sergei_lus at yahoo dot com
2009-08-25 13:39 ` bangerth at gmail dot com
2009-08-31 16:46 ` jakub at gcc dot gnu dot org
2010-01-02 16:25 ` rguenth 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).