public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/1920
@ 2003-05-06  0:16 Wolfgang Bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2003-05-06  0:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/1920; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ices.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/1920
Date: Mon, 5 May 2003 19:15:46 -0500 (CDT)

 Since 3.3, the programs also fails in non-optimized mode. I think it's all 
 about not issuing a warning if a cast-as-lvalue is passed by reference. 
 This extension is evil!
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                                www: http://www.ices.utexas.edu/~bangerth/
 
 


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

* Re: c++/1920
@ 2001-04-01  0:00 Joe Buck
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Buck @ 2001-04-01  0:00 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/1920; it has been noted by GNATS.

From: Joe Buck <jbuck@synopsys.com>
To: mdejong@redhat.com, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org,
        ebb9@email.byu.edu
Cc:  
Subject: Re: c++/1920
Date: Mon, 26 Feb 2001 15:02:39 -0800

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1920&database=gcc
 
 Eric's analysis is correct: this is not legal C++, and the bug is that
 neither gcc 2.95.2 nor CVS gcc issue any diagnostics.
 
 I've changed the status to "analyzed", "non-critical", "accepts-illegal"
 as Eric suggested.
 
 -- 
 The reasonable man adapts himself to the world; the unreasonable man
 persists in trying to adapt the world to himself. Therefore, all
 progress
 depends on the unreasonable man.         -----George Bernard Shaw


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

* Re: c++/1920
@ 2001-04-01  0:00 jbuck
  0 siblings, 0 replies; 4+ messages in thread
From: jbuck @ 2001-04-01  0:00 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/1920; it has been noted by GNATS.

From: jbuck@synopsys.com
To: gcc-gnats@gcc.gnu.org, mdejong@redhat.com, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/1920
Date: 26 Feb 2001 23:00:53 -0000

 Synopsis: g++ -O1 optimization bug in casting a reference argument
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: jbuck
 State-Changed-When: Mon Feb 26 15:00:53 2001
 State-Changed-Why:
     Eric Blake's analysis is correct.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1920&database=gcc


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

* Re: c++/1920
@ 2001-04-01  0:00 Eric Blake
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2001-04-01  0:00 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/1920; it has been noted by GNATS.

From: Eric Blake <ebb9@email.byu.edu>
To: mdejong@redhat.com, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/1920
Date: Fri, 09 Feb 2001 15:51:35 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1920&database=gcc
 
 Actually, it looks like this bug should be recategorized as
 accepts-illegal.  Consider this variation:
 
 #include <stdio.h>
 void foo(unsigned &bar)
 {
     bar = 1;
 }
 int main()
 {
     unsigned a = 0;
     foo((unsigned) a);
     if (a == 1)
         printf("OK\n");
     else {
         printf("a = %d, expeceted 1", a);
         return 1;
     }
     return 0;
 }
 
 $ g++ -o foo foo.cc
 foo.cc: In function `int main()':
 foo.cc:9: initialization of non-const reference type `unsigned int &'
 foo.cc:9: from rvalue of type `unsigned int'
 foo.cc:3: in passing argument 1 of `foo(unsigned int &)'
 
 Therefore, the fact that changing the declaration of a from unsigned to
 int allows the compiler to complete without warning or error is the true
 bug.  In line 10, (unsigned) a is an rvalue, which cannot be assigned to
 the non-const unsigned & of foo().  The correct cast in this situation
 would be (unsigned &) a, which does work as expected.
 
 -- 
 Eric Blake


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

end of thread, other threads:[~2003-05-06  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-06  0:16 c++/1920 Wolfgang Bangerth
  -- strict thread matches above, loose matches on Subject: below --
2001-04-01  0:00 c++/1920 Joe Buck
2001-04-01  0:00 c++/1920 jbuck
2001-04-01  0:00 c++/1920 Eric Blake

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).