summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr41779.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/c-c++-common/pr41779.c
downloadcbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2
cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr41779.c')
-rw-r--r--gcc/testsuite/c-c++-common/pr41779.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr41779.c b/gcc/testsuite/c-c++-common/pr41779.c
new file mode 100644
index 000000000..80c8e6b1d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr41779.c
@@ -0,0 +1,56 @@
+/* PR41779: Wconversion cannot see throught real*integer promotions. */
+/* { dg-do compile } */
+/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+
+float f1(float x, unsigned short y)
+{
+ return x * y;
+}
+
+float f2(float x, short y)
+{
+ return x * y;
+}
+
+float f3(float x, char y)
+{
+ return x * y;
+}
+
+float f4(float x, unsigned char y)
+{
+ return x * y;
+}
+
+float f5(float x, int y)
+{
+ return x * y; /* { dg-warning "conversion" } */
+}
+
+double c1(float x, unsigned short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c2(float x, short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c3(float x, char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c4(float x, unsigned char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c5(float x, int y, int z)
+{
+ return z ? x + x : y; /* { dg-warning "conversion" } */
+}