c/1650: Lack of ansi-C (pedantic) warning in -ansi -pedantic compilation mode
s3173243@t2.technion.ac.il
s3173243@t2.technion.ac.il
Sun Jan 14 17:16:00 GMT 2001
>Number: 1650
>Category: c
>Synopsis: Lack of ansi-C (pedantic) warning in -ansi -pedantic compilation mode
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Sun Jan 14 17:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Rani Sharoni
>Release: gcc version 2.95.2-6 19991024 (cygwin experimental)
>Organization:
>Environment:
Windows-NT on intel IA32 machine.
>Description:
the is relevant to -ansi -pedantic compilation mode
When initializing struct field with initializer element that
is not computable at load time of the form {func1() - func2()}
(yes - subtraction) there is no warning about it.
gcc -c test_case.c -ansi -pedantic
test_case.c: In function `main':
test_case.c:11: initializer element is not computable at load time
test_case.c:11: (near initialization for `V2.a')
test_case.c:12: initializer element is not computable at load time
test_case.c:12: (near initialization for `V3.a')
/***********
BUG - missing
test_case.c:10: initializer element is not computable at load time
test_case.c:10: (near initialization for `V1.a')
***********/
>How-To-Repeat:
/* gcc -c test_c.c -ansi -pedantic */
struct foo_S { int a;};
int
main(void)
{
extern int foo_a(int);
extern int foo_b(int);
struct foo_S V1 = { foo_a(1) - foo_b(1) };
struct foo_S V2 = { foo_a(1) + foo_b(1) };
struct foo_S V3 = { foo_a(1) * foo_b(1) };
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list