IBM Support

LI77954: C COMPILER INCORRECTLY REPORTS THAT AN IDENTIFIER IS UNDECLARED

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • The 'cc' compiler issues an error message related to an
    identifier even though the identifier has been declared.
    
    ======Compile Command:
    $ cc -c sample.c
    
    
    ======Test case:
    $ cat sample.c
    typedef signed long long        int64_t;
    typedef unsigned long long      uint64_t;
    typedef int64_t                 intmax_t;
    typedef uint64_t                uintmax_t;
    
    enum { SYSINT_BUFSIZE =
             (((((((sizeof (uintmax_t) * (8) - (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) + 1)) < ((((((sizeof (intmax_t) * (8) - (! ((__typeof__
    (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) + 1)) ? ((((((sizeof (intmax_t) * (8) - (! ((__typeof__
    (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) + 1)) : ((((((sizeof (uintmax_t) * (8) - (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) + 1))) };
    
    void
    show_snapshot_field_ranges (void)
    {
      char minbuf[((SYSINT_BUFSIZE) < ((((((sizeof (intmax_t) * (8)
    - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1)))
    * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 <
    (__typeof__ (intmax_t)) -1))) + 1)) ? ((((((sizeof (intmax_t) *
    (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 <
    (__typeof__ (intmax_t)) -1))) + 1)) : (SYSINT_BUFSIZE))];
      char maxbuf[((SYSINT_BUFSIZE) < ((((((sizeof (uintmax_t) * (8)
    - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 <
    (__typeof__ (uintmax_t)) -1))) + 1)) ? ((((((sizeof (uintmax_t)
    * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__
    (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)) :
    (SYSINT_BUFSIZE))];
    }
    

Local fix

  • Use temporaries to store the size of minbuf and maxbuf
    
    
    typedef signed long long        int64_t;
    typedef unsigned long long      uint64_t;
    typedef int64_t                 intmax_t;
    typedef uint64_t                uintmax_t;
    
    enum { SYSINT_BUFSIZE =
             (((((((sizeof (uintmax_t) * (8) - (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) + 1)) < ((((((sizeof (intmax_t) * (8) - (! ((__typeof__
    (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) + 1)) ? ((((((sizeof (intmax_t) * (8) - (! ((__typeof__
    (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) + 1)) : ((((((sizeof (uintmax_t) * (8) - (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) /
    485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) + 1))) };
    
    void
    show_snapshot_field_ranges (void)
    {
      int temp1 = ((SYSINT_BUFSIZE) < ((((((sizeof (intmax_t) * (8)
    - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1)))
    * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 <
    (__typeof__ (intmax_t)) -1))) + 1)) ? ((((((sizeof (intmax_t) *
    (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t))
    -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 <
    (__typeof__ (intmax_t)) -1))) + 1)) : (SYSINT_BUFSIZE));
      int temp2 = ((SYSINT_BUFSIZE) < ((((((sizeof (uintmax_t) * (8)
    - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t))
    -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 <
    (__typeof__ (uintmax_t)) -1))) + 1)) ? ((((((sizeof (uintmax_t)
    * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__
    (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__
    (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)) :
    (SYSINT_BUFSIZE));
      char minbuf[temp1];
      char maxbuf[temp2];
    }
    

Problem summary

  • USERS AFFECTED:
    Users of typeof extension in array declare are affected by this
    issue.
    
    PROBLEM DESCRIPTION:
    The compiler fails to analyze symbols in [], if there is typeof
    keyword.
    

Problem conclusion

  • The compiler has been fixed to resolve the aboe error.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77954

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-04-30

  • Closed date

    2014-04-30

  • Last modified date

    2014-04-30

  • APAR is sysrouted FROM one or more of the following:

    IV53918

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels



Document information

More support for: XL C/C++ for Linux
Compiler

Software version: 12.1

Reference #: LI77954

Modified date: 30 April 2014