diff options
author | dim <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
commit | 110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab (patch) | |
tree | 64a10f4c4154739d4a8191d7e1b52ce497f4ebd6 /test/Sema/exprs.c | |
parent | a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 (diff) | |
download | FreeBSD-src-110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab.zip FreeBSD-src-110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab.tar.gz |
Vendor import of clang trunk r130700:
http://llvm.org/svn/llvm-project/cfe/trunk@130700
Diffstat (limited to 'test/Sema/exprs.c')
-rw-r--r-- | test/Sema/exprs.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index 0d6c548..e4eeaec 100644 --- a/test/Sema/exprs.c +++ b/test/Sema/exprs.c @@ -12,6 +12,14 @@ } while (0) +// Test that we don't report divide-by-zero errors in unreachable code. +// This test should be left as is, as it also tests CFG functionality. +void radar9171946() { + if (0) { + 0 / (0 ? 1 : 0); // expected-warning {{expression result unused}} + } +} + int test_pr8876() { PR8876(0); // no-warning PR8876_pos(0); // expected-warning{{indirection of non-volatile null pointer will be deleted, not trap}} expected-note{{consider using __builtin_trap() or qualifying pointer with 'volatile'}} @@ -155,7 +163,7 @@ void test17(int x) { } // PR6501 -void test18_a(int a); +void test18_a(int a); // expected-note {{'test18_a' declared here}} void test18(int b) { test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}} test18_a(); // expected-error {{too few arguments to function call, expected 1, have 0}} @@ -166,6 +174,12 @@ void test19() { *(int*)0 = 0; // expected-warning {{indirection of non-volatile null pointer}} \ // expected-note {{consider using __builtin_trap}} *(volatile int*)0 = 0; // Ok. + + // rdar://9269271 + int x = *(int*)0; // expected-warning {{indirection of non-volatile null pointer}} \ + // expected-note {{consider using __builtin_trap}} + int x2 = *(volatile int*)0; // Ok. + int *p = &(*(int*)0); // Ok; } int test20(int x) { |