This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/1650: Lack of ansi-C (pedantic) warning in -ansi -pedantic compilation mode



>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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]