public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/10436: Taking address of casted value gives error
@ 2003-04-19  0:26 bero
  0 siblings, 0 replies; 2+ messages in thread
From: bero @ 2003-04-19  0:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10436
>Category:       c
>Synopsis:       Taking address of casted value gives error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 19 00:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Bernhard Rosenkraenzer
>Release:        gcc 3.3 branch as of 2003/04/15
>Organization:
>Environment:
Ark Linux Dockyard (Linux 2.4.20, glibc 2.3.2)
>Description:
The following simple code:

int test(void **tmp) { }

int main(int argc, char **argv)
{
        char *a="Test";
        test(&(void*)a);
}

gives:

test.c: In function `main':
test.c:6: error: invalid lvalue in unary `&'

This slightly longer, but equivalent variant works:
int test(void **tmp) { }

int main(int argc, char **argv)
{
        char *a="Test";
        void *b=(void*)a;
        test(&b);
}

Problem occurs with both the C and C++ front ends.
>How-To-Repeat:
Try to compile the sample code.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c/10436: Taking address of casted value gives error
@ 2003-04-19  1:06 neil
  0 siblings, 0 replies; 2+ messages in thread
From: neil @ 2003-04-19  1:06 UTC (permalink / raw)
  To: bero, gcc-bugs, gcc-prs, nobody

Synopsis: Taking address of casted value gives error

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sat Apr 19 01:06:25 2003
State-Changed-Why:
    Not a bug - the two are not equivalent; in one you're taking the address of an lvalue, in the other you're not.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10436


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

end of thread, other threads:[~2003-04-19  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-19  0:26 c/10436: Taking address of casted value gives error bero
2003-04-19  1:06 neil

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