c/10436: Taking address of casted value gives error
bero@arklinux.org
bero@arklinux.org
Sat Apr 19 00:26:00 GMT 2003
>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:
More information about the Gcc-bugs
mailing list