IBM Support

IV39332: INCORRECT WARNING ON RESTRICT POINTER TYPE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The testcase xlc_typedef_restrict.c below shows C compiler
    warning about incorrect usage of the restrict keyword, while
    the usage is correct. C++ compiler takes it happily with no
    warning message.
    
    ===== TESTCASE:
    $cat xlc_typedef_restrict.c
    #include <stdlib.h>
    
    struct foobar { void (*fp)(void *); };
    struct baz { const struct foobar *p; };
    struct foo { int a, b;  struct baz c; };
    typedef struct foo *bar;
    
    void func(struct foo* restrict p, struct foo* restrict q) {}
    
    void funk(bar restrict p, bar restrict q) {}
    
    int main()
    {
            bar p,q;
            bar restrict l;
            struct foo* restrict m;
            func(p,q);
            funk(p,q);
    }
    
    xlc  -c xlc_typedef_restrict.c
    "xlc_typedef_restrict.c", line 10.11: 1506-404 (W) restrict can
    only qualify a pointer type.
    "xlc_typedef_restrict.c", line 10.27: 1506-404 (W) restrict can
    only qualify a pointer type.
    "xlc_typedef_restrict.c", line 15.9: 1506-404 (W) restrict can
    only qualify a pointer type.
    

Local fix

  • Change
    struct foobar { void (*fp)(void *); };
    
    To
    struct foobar { void (**fp)(void); };
    

Problem summary

  • PROBLEM DESCRIPTION: Incorrect diagnose message of restrict
    pointer.
    
    USERS AFFECTED: Programs using restrcit qualifier on a
    struct/union pointer which contain function pointer member.
    

Problem conclusion

  • Problem is fixed. The warning message is not emitted. Apply
    provided service.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV39332

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5724X1200

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-04-04

  • Closed date

    2013-08-13

  • Last modified date

    2013-08-13

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

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

    LI77567 IV49626 LI77612

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5724X1200

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
13 August 2013