aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-04-26 07:21:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-04-26 07:21:42 +0000
commitbde84d51205c49afc0379757aa51bdb17a4eca10 (patch)
tree7dd9eb7318a103cdc57fba805851ed79c737c064 /gcc
parente92306590ef0c4e51a0fc0053469a28ed60b1c1c (diff)
downloadgcc-bde84d51205c49afc0379757aa51bdb17a4eca10.zip
gcc-bde84d51205c49afc0379757aa51bdb17a4eca10.tar.gz
gcc-bde84d51205c49afc0379757aa51bdb17a4eca10.tar.bz2
re PR middle-end/85450 (ICE: invalid types in nop conversion during GIMPLE pass: ompexp)
2018-04-26 Richard Biener <rguenther@suse.de> PR middle-end/85450 * tree-cfg.c (verify_gimple_assign_unary): Restore proper checking of integer<->pointer conversions. * omp-expand.c (expand_omp_for_static_nochunk): Avoid sign-/zero-extending pointer types. (expand_omp_for_static_chunk): Likewise. From-SVN: r259667
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/omp-expand.c28
-rw-r--r--gcc/tree-cfg.c2
3 files changed, 34 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dd88190..d3834b0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2018-04-26 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85450
+ * tree-cfg.c (verify_gimple_assign_unary): Restore proper
+ checking of integer<->pointer conversions.
+ * omp-expand.c (expand_omp_for_static_nochunk): Avoid
+ sign-/zero-extending pointer types.
+ (expand_omp_for_static_chunk): Likewise.
+
2018-03-22 Hans-Peter Nilsson <hp@axis.com>
Jean Lee <xiaoyur347@gmail.com>
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index c7d30ea..d2a77c0 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -3501,7 +3501,12 @@ expand_omp_for_static_nochunk (struct omp_region *region,
t = fold_convert (itype, s0);
t = fold_build2 (MULT_EXPR, itype, t, step);
if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (n1, t);
+ {
+ t = fold_build_pointer_plus (n1, t);
+ if (!POINTER_TYPE_P (TREE_TYPE (startvar))
+ && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type))
+ t = fold_convert (signed_type_for (type), t);
+ }
else
t = fold_build2 (PLUS_EXPR, type, t, n1);
t = fold_convert (TREE_TYPE (startvar), t);
@@ -3515,7 +3520,12 @@ expand_omp_for_static_nochunk (struct omp_region *region,
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, step);
if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (n1, t);
+ {
+ t = fold_build_pointer_plus (n1, t);
+ if (!POINTER_TYPE_P (TREE_TYPE (startvar))
+ && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type))
+ t = fold_convert (signed_type_for (type), t);
+ }
else
t = fold_build2 (PLUS_EXPR, type, t, n1);
t = fold_convert (TREE_TYPE (startvar), t);
@@ -4000,7 +4010,12 @@ expand_omp_for_static_chunk (struct omp_region *region,
t = fold_convert (itype, s0);
t = fold_build2 (MULT_EXPR, itype, t, step);
if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (n1, t);
+ {
+ t = fold_build_pointer_plus (n1, t);
+ if (!POINTER_TYPE_P (TREE_TYPE (startvar))
+ && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type))
+ t = fold_convert (signed_type_for (type), t);
+ }
else
t = fold_build2 (PLUS_EXPR, type, t, n1);
t = fold_convert (TREE_TYPE (startvar), t);
@@ -4014,7 +4029,12 @@ expand_omp_for_static_chunk (struct omp_region *region,
t = fold_convert (itype, e0);
t = fold_build2 (MULT_EXPR, itype, t, step);
if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (n1, t);
+ {
+ t = fold_build_pointer_plus (n1, t);
+ if (!POINTER_TYPE_P (TREE_TYPE (startvar))
+ && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type))
+ t = fold_convert (signed_type_for (type), t);
+ }
else
t = fold_build2 (PLUS_EXPR, type, t, n1);
t = fold_convert (TREE_TYPE (startvar), t);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9485f73..c4767a3 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3842,7 +3842,7 @@ verify_gimple_assign_unary (gassign *stmt)
|| (POINTER_TYPE_P (rhs1_type)
&& INTEGRAL_TYPE_P (lhs_type)
&& (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type)
- || ptrofftype_p (sizetype))))
+ || ptrofftype_p (lhs_type))))
return false;
/* Allow conversion from integral to offset type and vice versa. */