[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-bugs] GCC Complaint: "init from incompatible pointer type"

Eric Eide wrote:

Below is an example hand-coded program that triggers a warning like the one
above from Clang 3.2.  This example is based on the example in Question 11.10
of the C FAQ.

void foo()
    volatile int i = 0;
    int *p;
    volatile int **q = &p; /* warning */
    *q = &i;
    *p = 1; /* undefined */

It's undefined because a non-volatile pointer "p" points to a volatile object "i".

- Yang