public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/32023]  New: Invalid lvalue in void* increment error inconsitensy
@ 2007-05-21 14:29 nshmyrev at yandex dot ru
  2007-05-21 14:45 ` [Bug c/32023] " schwab at suse dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-21 14:29 UTC (permalink / raw)
  To: gcc-bugs

The following program doesn't compile due to invalid lvalue in increment. The
most strange thing is that gcc somehow ignores type coercion

int main ()
{
int **a;
void **b;

*b++;            /* works fine */
*((void **)a)++; / gives error */

return 0;
}


-- 
           Summary: Invalid lvalue in void* increment error inconsitensy
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nshmyrev at yandex dot ru
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c/32023] Invalid lvalue in void* increment error inconsitensy
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
@ 2007-05-21 14:45 ` schwab at suse dot de
  2007-05-22 17:16 ` [Bug c/32023] No casts in lvalue error message nshmyrev at yandex dot ru
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab at suse dot de @ 2007-05-21 14:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2007-05-21 15:45 -------
A cast is not an lvalue.


-- 

schwab at suse dot de changed:

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


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
  2007-05-21 14:45 ` [Bug c/32023] " schwab at suse dot de
@ 2007-05-22 17:16 ` nshmyrev at yandex dot ru
  2007-05-22 17:27 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-22 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from nshmyrev at yandex dot ru  2007-05-22 18:16 -------
Ok, I understand it. Gcc dropped support for cast in lvalues. But can the
message be more specific about the problem itself. It's really hard to
understand the reason from the current one.


-- 

nshmyrev at yandex dot ru changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
            Summary|Invalid lvalue in void*     |No casts in lvalue error
                   |increment error inconsitensy|message


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
  2007-05-21 14:45 ` [Bug c/32023] " schwab at suse dot de
  2007-05-22 17:16 ` [Bug c/32023] No casts in lvalue error message nshmyrev at yandex dot ru
@ 2007-05-22 17:27 ` pinskia at gcc dot gnu dot org
  2007-05-22 17:33 ` nshmyrev at yandex dot ru
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 17:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-05-22 18:27 -------
t.c:9: error: lvalue required as increment operand


I don't see what the problem is, the error message is clear, a lvalue is
required for the increment operand.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (2 preceding siblings ...)
  2007-05-22 17:27 ` pinskia at gcc dot gnu dot org
@ 2007-05-22 17:33 ` nshmyrev at yandex dot ru
  2007-05-22 20:33 ` schwab at suse dot de
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-22 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from nshmyrev at yandex dot ru  2007-05-22 18:33 -------
gcc can explain why ((void **)a) is not lvalue, it's really not that clear.


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (3 preceding siblings ...)
  2007-05-22 17:33 ` nshmyrev at yandex dot ru
@ 2007-05-22 20:33 ` schwab at suse dot de
  2007-05-22 20:36 ` nshmyrev at yandex dot ru
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab at suse dot de @ 2007-05-22 20:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from schwab at suse dot de  2007-05-22 21:32 -------
Because the standard says so?


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (4 preceding siblings ...)
  2007-05-22 20:33 ` schwab at suse dot de
@ 2007-05-22 20:36 ` nshmyrev at yandex dot ru
  2007-05-22 20:51 ` schwab at suse dot de
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-22 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from nshmyrev at yandex dot ru  2007-05-22 21:36 -------
Ok, add a line:

"According to standard cast is not lvalue"

I'll be happy.


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (5 preceding siblings ...)
  2007-05-22 20:36 ` nshmyrev at yandex dot ru
@ 2007-05-22 20:51 ` schwab at suse dot de
  2007-05-22 23:13 ` nshmyrev at yandex dot ru
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab at suse dot de @ 2007-05-22 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from schwab at suse dot de  2007-05-22 21:51 -------
Everything is "according to the standard".  That's where C is defined.


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (6 preceding siblings ...)
  2007-05-22 20:51 ` schwab at suse dot de
@ 2007-05-22 23:13 ` nshmyrev at yandex dot ru
  2007-05-22 23:27 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-22 23:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from nshmyrev at yandex dot ru  2007-05-23 00:12 -------
The point I'm trying to express is that it's useful for user to have more
precise explanation.

gcc dropped a lot of features which weren't included in standard recently and
thus many of us wondering why the code which compiled before doesn't compile
now. It's fine for me to have strict compiler but it's also useful to get at
least an idea what compiler doesn't like without reading whole standard.


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (7 preceding siblings ...)
  2007-05-22 23:13 ` nshmyrev at yandex dot ru
@ 2007-05-22 23:27 ` pinskia at gcc dot gnu dot org
  2007-05-23 15:57 ` manu at gcc dot gnu dot org
  2007-05-23 16:06 ` nshmyrev at yandex dot ru
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 23:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2007-05-23 00:27 -------
(In reply to comment #8)
> gcc dropped a lot of features which weren't included in standard recently and
> thus many of us wondering why the code which compiled before doesn't compile
> now. It's fine for me to have strict compiler but it's also useful to get at
> least an idea what compiler doesn't like without reading whole standard.

And that is exactly why GCC has changes page to describe these changes.  Yes
this specific change is documented on that page.


-- 


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (8 preceding siblings ...)
  2007-05-22 23:27 ` pinskia at gcc dot gnu dot org
@ 2007-05-23 15:57 ` manu at gcc dot gnu dot org
  2007-05-23 16:06 ` nshmyrev at yandex dot ru
  10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-23 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from manu at gcc dot gnu dot org  2007-05-23 16:57 -------
(In reply to comment #8)
> The point I'm trying to express is that it's useful for user to have more
> precise explanation.
> 

Would you be happy with something like?

t.c:9: error: lvalue required as increment operand
t.c:9: note: a cast is not a lvalue

Perhaps we could even pack it in a single line.

The feasibility of this depends on whether we can get this information when we
emit the diagnostic. I think if someone wants to pursue it, it shouldn't be
difficult. So why not keep it open? Low-hanging fruit like this is ideal for
newbies.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-23 16:57:17
               date|                            |


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


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

* [Bug c/32023] No casts in lvalue error message
  2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
                   ` (9 preceding siblings ...)
  2007-05-23 15:57 ` manu at gcc dot gnu dot org
@ 2007-05-23 16:06 ` nshmyrev at yandex dot ru
  10 siblings, 0 replies; 12+ messages in thread
From: nshmyrev at yandex dot ru @ 2007-05-23 16:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from nshmyrev at yandex dot ru  2007-05-23 17:06 -------
Exactly :) Thanks Manuel


-- 


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


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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-21 14:29 [Bug c/32023] New: Invalid lvalue in void* increment error inconsitensy nshmyrev at yandex dot ru
2007-05-21 14:45 ` [Bug c/32023] " schwab at suse dot de
2007-05-22 17:16 ` [Bug c/32023] No casts in lvalue error message nshmyrev at yandex dot ru
2007-05-22 17:27 ` pinskia at gcc dot gnu dot org
2007-05-22 17:33 ` nshmyrev at yandex dot ru
2007-05-22 20:33 ` schwab at suse dot de
2007-05-22 20:36 ` nshmyrev at yandex dot ru
2007-05-22 20:51 ` schwab at suse dot de
2007-05-22 23:13 ` nshmyrev at yandex dot ru
2007-05-22 23:27 ` pinskia at gcc dot gnu dot org
2007-05-23 15:57 ` manu at gcc dot gnu dot org
2007-05-23 16:06 ` nshmyrev at yandex dot ru

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