[Bug c/91973] New: gcc failed for Multiple level macro expansion
qinzhao at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 2 16:08:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91973
Bug ID: 91973
Summary: gcc failed for Multiple level macro expansion
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: qinzhao at gcc dot gnu.org
Target Milestone: ---
GCC cannot compile the following small testing case:
[qinzhao@localhost]$ cat t1.c
extern void boo (void *addr);
#define foo(addr) \
boo (addr)
#define bar(instr, addr) \
(instr) (addr)
void check (void *addr)
{
bar(foo, addr);
}
[qinzhao@localhost]$ sh t
/home/qinzhao/Install/latest/bin/gcc -O -S t1.c
t1.c: In function ‘check’:
t1.c:11:7: error: ‘foo’ undeclared (first use in this function); did you mean
‘boo’?
11 | bar(foo, addr);
| ^~~
t1.c:7:4: note: in definition of macro ‘bar’
7 | (instr) (addr)
| ^~~~~
t1.c:11:7: note: each undeclared identifier is reported only once for each
function it appears in
11 | bar(foo, addr);
| ^~~
t1.c:7:4: note: in definition of macro ‘bar’
7 | (instr) (addr)
| ^~~~~
However, if I delete the parantheses from the macro bar as following:
#define bar(instr, addr) \
instr (addr)
The compilation succeed.
also icc can successfully compile the original small testing case.
More information about the Gcc-bugs
mailing list