This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR64415
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Jan 2015 14:04:26 +0100 (CET)
- Subject: [PATCH] Fix PR64415
- Authentication-results: sourceware.org; auth=none
The following removes -fvar-tracking-assignments from being eligible
to the optimization attribute/pragma which fixes LTO operation for
mixed inputs (LTO just drops debug stmts if the flag is false).
In theory we could also fix inlining to do that when inlining
debug stmts into a non-VTA function but I think allowing this
kind of per-function IL flags is just silly.
Thoughts?
Thanks,
Richard.
2015-01-13 Richard Biener <rguenther@suse.de>
PR lto/64415
* common.opt (fvar-tracking-assignments): Remove 'Optimization'
flag.
(fvar-tracking-assignments-toggle): Likewise.
* gcc.dg/lto/pr64415_0.c: New testcase.
* gcc.dg/lto/pr64415_1.c: Likewise.
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 219520)
+++ gcc/common.opt (working copy)
@@ -2397,13 +2397,13 @@ Perform variable tracking
; annotations. When flag_var_tracking_assignments ==
; AUTODETECT_VALUE it will be set according to flag_var_tracking.
fvar-tracking-assignments
-Common Report Var(flag_var_tracking_assignments) Init(2) Optimization
+Common Report Var(flag_var_tracking_assignments) Init(2)
Perform variable tracking by annotating assignments
; Nonzero if we should toggle flag_var_tracking_assignments after
; processing options and computing its default. */
fvar-tracking-assignments-toggle
-Common Report Var(flag_var_tracking_assignments_toggle) Optimization
+Common Report Var(flag_var_tracking_assignments_toggle)
Toggle -fvar-tracking-assignments
; Positive if we should track uninitialized variables, negative if
Index: gcc/testsuite/gcc.dg/lto/pr64415_0.c
===================================================================
--- gcc/testsuite/gcc.dg/lto/pr64415_0.c (revision 0)
+++ gcc/testsuite/gcc.dg/lto/pr64415_0.c (working copy)
@@ -0,0 +1,13 @@
+/* { dg-lto-do link } */
+/* { dg-require-effective-target fpic } */
+/* { dg-lto-options { { -O -flto -fpic } } } */
+/* { dg-extra-ld-options { -shared } } */
+
+extern void bar(char *, int);
+
+extern char *baz;
+
+void foo()
+{
+ bar(baz, 0);
+}
Index: gcc/testsuite/gcc.dg/lto/pr64415_1.c
===================================================================
--- gcc/testsuite/gcc.dg/lto/pr64415_1.c (revision 0)
+++ gcc/testsuite/gcc.dg/lto/pr64415_1.c (working copy)
@@ -0,0 +1,17 @@
+/* { dg-options "-g" } */
+
+extern int n;
+
+void bar(char *, int);
+
+inline void bar(char *s, int i)
+{
+ char *p = s;
+
+#ifdef V1
+ if (i)
+#else
+ if (n)
+#endif
+ *s = 0;
+}