aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-15 22:15:30 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-15 22:15:30 +0000
commit604f8abb2bcbd162e61c49d408b99357712d592a (patch)
tree259c1117838452e7f49ae998992c0cea9dbdb86d /gcc/testsuite/gcc.c-torture/execute
parent0e9c9350c0d92ca3e9dc556eef55f05a5197073b (diff)
PR tree-optimization/83269
* fold-const.c (fold_binary_loc): Perform (-A) - B -> (-B) - A subtraction in arg0's type if type is signed and arg0 is unsigned. Formatting fix. * gcc.c-torture/execute/pr83269.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255729 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr83269.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr83269.c b/gcc/testsuite/gcc.c-torture/execute/pr83269.c
new file mode 100644
index 00000000000..37fc5d14db7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr83269.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/83269 */
+
+int
+main ()
+{
+#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ > 4 && __CHAR_BIT__ == 8
+ volatile unsigned char a = 1;
+ long long b = 0x80000000L;
+ int c = -((int)(-b) - (-0x7fffffff * a));
+ if (c != 1)
+ __builtin_abort ();
+#endif
+ return 0;
+}