+2008-01-16 Richard Guenther <rguenther@suse.de>
+
+ PR c/34768
+ * c-typeck.c (common_pointer_type): Do not merge inconsistent
+ type qualifiers for function types.
+
2008-01-15 Sebastian Pop <sebastian.pop@amd.com>
* tree-parloops (gen_parallel_loop): Revert my fix.
tree pointed_to_1, mv1;
tree pointed_to_2, mv2;
tree target;
+ unsigned target_quals;
/* Save time if the two types are the same. */
if (TREE_CODE (mv2) != ARRAY_TYPE)
mv2 = TYPE_MAIN_VARIANT (pointed_to_2);
target = composite_type (mv1, mv2);
- t1 = build_pointer_type (c_build_qualified_type
- (target,
- TYPE_QUALS (pointed_to_1) |
- TYPE_QUALS (pointed_to_2)));
+
+ /* For function types do not merge const qualifiers, but drop them
+ if used inconsistently. The middle-end uses these to mark const
+ and noreturn functions. */
+ if (TREE_CODE (pointed_to_1) == FUNCTION_TYPE)
+ target_quals = TYPE_QUALS (pointed_to_1) & TYPE_QUALS (pointed_to_2);
+ else
+ target_quals = TYPE_QUALS (pointed_to_1) | TYPE_QUALS (pointed_to_2);
+ t1 = build_pointer_type (c_build_qualified_type (target, target_quals));
return build_type_attribute_variant (t1, attributes);
}
+2008-01-16 Richard Guenther <rguenther@suse.de>
+
+ PR c/34768
+ * gcc.c-torture/execute/pr34768-1.c: New testcase.
+ * gcc.c-torture/execute/pr34768-2.c: Likewise.
+
2008-01-16 Tobias Burnus <burnus@net-b.de>
PR fortran/34796
--- /dev/null
+int x;
+
+void __attribute__((noinline)) foo (void)
+{
+ x = -x;
+}
+void __attribute__((const,noinline)) bar (void)
+{
+}
+
+int __attribute__((noinline))
+test (int c)
+{
+ int tmp = x;
+ (c ? foo : bar) ();
+ return tmp + x;
+}
+
+extern void abort (void);
+int main()
+{
+ x = 1;
+ if (test (1) != 0)
+ abort ();
+ return 0;
+}
--- /dev/null
+int x;
+
+int __attribute__((noinline)) foo (void)
+{
+ x = -x;
+ return 0;
+}
+int __attribute__((const,noinline)) bar (void)
+{
+ return 0;
+}
+
+int __attribute__((noinline))
+test (int c)
+{
+ int tmp = x;
+ int res = (c ? foo : bar) ();
+ return tmp + x + res;
+}
+
+extern void abort (void);
+int main()
+{
+ x = 1;
+ if (test (1) != 0)
+ abort ();
+ return 0;
+}