public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12877] New: conditional as lvalue gives wrong warning
@ 2003-11-02 18:21 falk at debian dot org
2003-11-02 21:10 ` [Bug c/12877] " jsm at polyomino dot org dot uk
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: falk at debian dot org @ 2003-11-02 18:21 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
Summary: conditional as lvalue gives wrong warning
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: falk at debian dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: alphaev68-unknown-linux-gnu
GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu
falk@juist:~% cat bug1.c
void f (void) {
char c, d;
(1 ? c : d) = 0;
}
falk@juist:~% gcc -c bug1.c
bug1.c: In function `f':
bug1.c:3: warning: use of cast expressions as lvalues is deprecated
But it's a conditional, not a cast, and I think this extension isn't
deprecated.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
@ 2003-11-02 21:10 ` jsm at polyomino dot org dot uk
2003-11-02 21:36 ` falk dot hueffner at student dot uni-tuebingen dot de
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jsm at polyomino dot org dot uk @ 2003-11-02 21:10 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
------- Additional Comments From jsm at polyomino dot org dot uk 2003-11-02 21:10 -------
Subject: Re: New: conditional as lvalue gives wrong warning
On Sun, 2 Nov 2003, falk at debian dot org wrote:
> But it's a conditional, not a cast, and I think this extension isn't
> deprecated.
The cast is implicit; the semantics of conditional expressions mean that
the chars are converted to a common type of int before the conditional
expression is applied to them. Essentially, the extension in question
wasn't properly thought out for anything other than the case of a common
type that is unaffected by the integer promotions. The problem is
arguably that we don't get a hard error here. A similar case where
instead of a straight assignment the conditional expression was being used
as an output for an asm was rejected (PR 11564); the types there were
different but the problem applies just as much where they are the same but
get promoted.
This extension only isn't deprecated *yet* so that the deprecations (and
any associated problems) could be dealt with one at a time. PR 11427 has
a specific suggestion that it be deprecated and no objections thereto.
I'm inclined on that basis to go ahead with deprecating conditional
expressions as lvalues in C for 3.4, and then follow with compound
expressions, also for 3.4.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
2003-11-02 21:10 ` [Bug c/12877] " jsm at polyomino dot org dot uk
@ 2003-11-02 21:36 ` falk dot hueffner at student dot uni-tuebingen dot de
2003-11-05 4:25 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: falk dot hueffner at student dot uni-tuebingen dot de @ 2003-11-02 21:36 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de 2003-11-02 21:36 -------
Subject: Re: conditional as lvalue gives wrong warning
"jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org> writes:
> > But it's a conditional, not a cast, and I think this extension isn't
> > deprecated.
>
> The cast is implicit; the semantics of conditional expressions mean that
> the chars are converted to a common type of int before the conditional
> expression is applied to them.
Well, as a technical term, casts are always explicit; what happens is
a conversion. So IMHO the message is still wrong.
> Essentially, the extension in question wasn't properly thought out
> for anything other than the case of a common type that is unaffected
> by the integer promotions. The problem is arguably that we don't
> get a hard error here.
C++ has deal with it, so if we really wanted to, it should be possible
to come up with sensible semantics.
> This extension only isn't deprecated *yet* so that the deprecations
> (and any associated problems) could be dealt with one at a time. PR
> 11427 has a specific suggestion that it be deprecated and no
> objections thereto. I'm inclined on that basis to go ahead with
> deprecating conditional expressions as lvalues in C for 3.4, and
> then follow with compound expressions, also for 3.4.
I agree.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
2003-11-02 21:10 ` [Bug c/12877] " jsm at polyomino dot org dot uk
2003-11-02 21:36 ` falk dot hueffner at student dot uni-tuebingen dot de
@ 2003-11-05 4:25 ` pinskia at gcc dot gnu dot org
2003-11-09 2:06 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-05 4:25 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |patch
Last reconfirmed|0000-00-00 00:00:00 |2003-11-05 04:25:22
date| |
Target Milestone|--- |3.4
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-05 04:25 -------
Patch to Deprecate this extension: <http://gcc.gnu.org/ml/gcc-patches/2003-11/
msg00262.html> and fixes the error.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
` (2 preceding siblings ...)
2003-11-05 4:25 ` pinskia at gcc dot gnu dot org
@ 2003-11-09 2:06 ` pinskia at gcc dot gnu dot org
2003-12-21 23:58 ` pinskia at gcc dot gnu dot org
2004-01-23 3:46 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-09 2:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-09 02:06 -------
The warning is correct but the warning abour conditional lvalue is not there. :(
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords|patch |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
` (3 preceding siblings ...)
2003-11-09 2:06 ` pinskia at gcc dot gnu dot org
@ 2003-12-21 23:58 ` pinskia at gcc dot gnu dot org
2004-01-23 3:46 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-21 23:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-21 23:40 -------
Not a regression but will be removed for 3.5 anyway so moving it to that.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-11-05 04:25:22 |2003-12-21 23:40:14
date| |
Target Milestone|3.4.0 |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/12877] conditional as lvalue gives wrong warning
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
` (4 preceding siblings ...)
2003-12-21 23:58 ` pinskia at gcc dot gnu dot org
@ 2004-01-23 3:46 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-23 3:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-23 03:46 -------
Closing as will not fix as the error says invalid lvalue in assignment now.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-01-23 3:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-02 18:21 [Bug c/12877] New: conditional as lvalue gives wrong warning falk at debian dot org
2003-11-02 21:10 ` [Bug c/12877] " jsm at polyomino dot org dot uk
2003-11-02 21:36 ` falk dot hueffner at student dot uni-tuebingen dot de
2003-11-05 4:25 ` pinskia at gcc dot gnu dot org
2003-11-09 2:06 ` pinskia at gcc dot gnu dot org
2003-12-21 23:58 ` pinskia at gcc dot gnu dot org
2004-01-23 3:46 ` pinskia 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).