<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Regression: -Wnull-dereference (part of -Wall) even applies to expressions that are not evaluated."
   href="https://llvm.org/bugs/show_bug.cgi?id=26398">26398</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: -Wnull-dereference (part of -Wall) even applies to expressions that are not evaluated.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ed@80386.nl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I just upgraded from LLVM+Clang 3.7.1 to LLVM+Clang 3.8.0rc1 and I noticed that
the following code now generates a compiler warning/error:

$ cat bla.c
#define some_generic_function(x) \
    _Generic(*(x),               \
             int: some_generic_function_int)(x)

static int *some_generic_function_int(int *x) {
  return x;
}

void some_function(void);
void some_function(void) {
  some_generic_function((int *)0);
}
$ x86_64-unknown-cloudabi-cc -O3 -Wall -Werror bla.c
bla.c:11:3: error: indirection of non-volatile null pointer will be deleted,
not trap [-Werror,-Wnull-dereference]
  some_generic_function((int *)0);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bla.c:2:14: note: expanded from macro 'some_generic_function'
    _Generic(*(x),               \
             ^~~~
bla.c:11:3: note: consider using __builtin_trap() or qualifying pointer with
'volatile'
bla.c:2:14: note: expanded from macro 'some_generic_function'
    _Generic(*(x),               \
             ^
1 error generated.

The warning should obviously not trigger in this case; the expression passed to
_Generic() is not evaluated. This is also not an uncommon construct. With
_Generic() you often want to match a type without any cv-qualifiers on the
pointer type. Dereferencing the expression is an easy way to get rid of those.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>