public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch][RFC] bail out after front-end errors
@ 2012-03-26 20:56 Steven Bosscher
  2012-03-27  7:17 ` Richard Guenther
  2012-03-27 19:00 ` Mike Stump
  0 siblings, 2 replies; 7+ messages in thread
From: Steven Bosscher @ 2012-03-26 20:56 UTC (permalink / raw)
  To: GCC Mailing List, GCC Patches

Hello,

This patch is one way to address PR44982. I see no good reason to
cgraph_finalize_compilation_unit if there were parse errors. As Richi
already pointed out, GCC traditionally has proceeded after parse
errors to preserve warnings and errors we generate from the middle-end
and during semantic analysis. But it seems to me that those warnings
are not very meaningful after parse errors (-Wuninitialized after a
parse error??), and errors from the middle end are mostly for exotic
code (involving asm()s and the like). Bailing out after parse errors
is therefore IMHO the right thing to do for the common case.

Thoughts? Comments?

If the consensus is that this patch goes in, I'll also have to do some
work on the test suite, because some warnings and errors disappear.
List attached below. A lot of errors and warnings from g++ disappear.
I suspect this is because they are only issued during gimplification.
That is something I'll have to address before this patch could go in.
Before I spend the effort, I'd like to know if there is consensus on
the general direction proposed here... ;-)

Ciao!
Steven



Index: toplev.c
===================================================================
--- toplev.c    (revision 185813)
+++ toplev.c    (working copy)
@@ -561,9 +561,14 @@ compile_file (void)
   /* Compilation is now finished except for writing
      what's left of the symbol table output.  */

-  if (flag_syntax_only || flag_wpa)
+  /* If all we have to do is syntax checking, or if there were parse
+     errors, stop here.  */
+  if (flag_syntax_only || seen_error ())
     return;

+  if (flag_wpa)
+    return;
+
   timevar_start (TV_PHASE_GENERATE);

   ggc_protect_identifiers = false;
@@ -571,12 +576,6 @@ compile_file (void)
   /* This must also call cgraph_finalize_compilation_unit.  */
   lang_hooks.decls.final_write_globals ();

-  if (seen_error ())
-    {
-      timevar_stop (TV_PHASE_GENERATE);
-      return;
-    }
-
   /* Compilation unit is finalized.  When producing non-fat LTO object, we are
      basically finished.  */
   if (in_lto_p || !flag_lto || flag_fat_lto_objects)


New failing tests:
> FAIL: gcc.dg/asm-7.c  (test for errors, line 15)
> FAIL: gcc.dg/asm-7.c  (test for errors, line 16)
> FAIL: gcc.dg/declspec-10.c  (test for warnings, line 19)
> FAIL: gcc.dg/declspec-11.c  (test for warnings, line 19)
> FAIL: gcc.dg/declspec-9.c  (test for errors, line 20)
> FAIL: gcc.dg/gnu99-static-1.c  (test for errors, line 21)
> FAIL: gcc.dg/gnu99-static-1.c  (test for errors, line 25)
> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 16)
> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 40)
> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 52)
> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 16)
> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 40)
> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 52)
> FAIL: gcc.dg/redecl-10.c  (test for warnings, line 15)
> FAIL: gcc.dg/redecl-10.c  (test for warnings, line 29)
> FAIL: gcc.dg/gomp/block-2.c  (test for errors, line 14)
> FAIL: gcc.dg/gomp/block-2.c  (test for errors, line 16)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 9)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 10)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 11)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 15)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 16)
> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 17)
> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 9)
> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 28)
> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 37)
> FAIL: c-c++-common/tm/safe-3.c (internal compiler error)
> FAIL: c-c++-common/tm/safe-3.c (test for excess errors)
> FAIL: gcc.dg/tm/pr52141.c (internal compiler error)
> FAIL: gcc.dg/tm/pr52141.c (test for excess errors)
> FAIL: g++.dg/cpp0x/constexpr-ex1.C  (test for warnings, line 17)
> FAIL: g++.dg/cpp0x/constexpr-function2.C  (test for warnings, line 46)
> FAIL: g++.dg/cpp0x/constexpr-neg1.C  (test for warnings, line 5)
> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C  (test for warnings, line 15)
> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C not an aggregate (test for errors, line 16)
> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C deleted default ctor (test for errors, line 17)
> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C deleted assignment op (test for errors, line 18)
> FAIL: g++.dg/cpp0x/lambda/lambda-field-names.C no member named i (test for errors, line 11)
> FAIL: g++.dg/cpp0x/noexcept15.C  (test for errors, line 16)
> FAIL: g++.dg/cpp0x/pr47416.C  (test for errors, line 187)
> FAIL: g++.dg/cpp0x/pr47416.C  (test for warnings, line 213)
> FAIL: g++.dg/cpp0x/pr47416.C  (test for warnings, line 223)
> FAIL: g++.dg/cpp0x/static_assert2.C  (test for errors, line 14)
> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 17)
> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 18)
> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 28)
> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 29)
> FAIL: g++.dg/cpp0x/vt-37737-2.C  (test for warnings, line 4)
> FAIL: g++.dg/cpp0x/vt-37737-2.C  (test for errors, line 6)
> FAIL: g++.dg/cpp0x/vt-37737-2.C candidate note (test for warnings, line 6)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for errors, line 14)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for errors, line 15)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for warnings, line 25)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for errors, line 14)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for errors, line 15)
> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for warnings, line 25)
> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for warnings, line 44)
> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for warnings, line 46)
> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for errors, line 51)
> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for warnings, line 44)
> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for warnings, line 46)
> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for errors, line 51)
> FAIL: g++.dg/parse/template18.C -std=c++98  (test for errors, line 47)
> FAIL: g++.dg/parse/template18.C -std=c++98  (test for warnings, line 52)
> FAIL: g++.dg/parse/template18.C -std=c++11  (test for errors, line 47)
> FAIL: g++.dg/parse/template18.C -std=c++11  (test for warnings, line 52)
> FAIL: g++.dg/parse/typename7.C -std=c++98  (test for warnings, line 10)
> FAIL: g++.dg/parse/typename7.C -std=c++98  (test for warnings, line 11)
> FAIL: g++.dg/parse/typename7.C -std=c++98 candidate note (test for warnings, line 12)
> FAIL: g++.dg/parse/typename7.C -std=c++98 candidate note (test for warnings, line 22)
> FAIL: g++.dg/parse/typename7.C -std=c++11  (test for warnings, line 10)
> FAIL: g++.dg/parse/typename7.C -std=c++11  (test for warnings, line 11)
> FAIL: g++.dg/parse/typename7.C -std=c++11 candidate note (test for warnings, line 12)
> FAIL: g++.dg/parse/typename7.C -std=c++11 candidate note (test for warnings, line 22)
> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for warnings, line 22)
> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for errors, line 27)
> FAIL: g++.dg/tc1/dr152.C -std=c++98 matching (test for errors, line 33)
> FAIL: g++.dg/tc1/dr152.C -std=c++98 candidate note (test for warnings, line 33)
> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for warnings, line 37)
> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for warnings, line 22)
> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for errors, line 27)
> FAIL: g++.dg/tc1/dr152.C -std=c++11 matching (test for errors, line 33)
> FAIL: g++.dg/tc1/dr152.C -std=c++11 candidate note (test for warnings, line 33)
> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for warnings, line 37)
> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 27)
> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for warnings, line 35)
> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 44)
> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 45)
> FAIL: g++.dg/tc1/dr166.C -std=c++11  (test for warnings, line 50)
> FAIL: g++.dg/template/access2.C -std=c++98  (test for errors, line 8)
> FAIL: g++.dg/template/access2.C -std=c++98  (test for errors, line 13)
> FAIL: g++.dg/template/access2.C -std=c++98  (test for warnings, line 19)
> FAIL: g++.dg/template/access2.C -std=c++11  (test for errors, line 8)
> FAIL: g++.dg/template/access2.C -std=c++11  (test for errors, line 13)
> FAIL: g++.dg/template/access2.C -std=c++11  (test for warnings, line 19)
> FAIL: g++.dg/template/crash107.C -std=gnu++98  (test for warnings, line 13)
> FAIL: g++.dg/template/crash107.C -std=gnu++98  (test for warnings, line 20)
> FAIL: g++.dg/template/crash107.C -std=gnu++11  (test for warnings, line 13)
> FAIL: g++.dg/template/crash107.C -std=gnu++11  (test for warnings, line 20)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 86)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 110)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 110)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 112)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 112)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 115)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 115)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 123)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 123)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 110)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 110)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 112)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 112)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 115)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 115)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 123)
> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 123)
> FAIL: g++.dg/template/error15.C -std=c++98  (test for errors, line 21)
> FAIL: g++.dg/template/error15.C -std=c++11  (test for errors, line 21)
> FAIL: g++.dg/template/error43.C -std=c++98  (test for warnings, line 9)
> FAIL: g++.dg/template/error43.C -std=c++11  (test for warnings, line 9)
> FAIL: g++.dg/template/friend31.C -std=c++98  (test for errors, line 13)
> FAIL: g++.dg/template/friend31.C -std=c++98  (test for errors, line 18)
> FAIL: g++.dg/template/friend31.C -std=c++11  (test for errors, line 13)
> FAIL: g++.dg/template/friend31.C -std=c++11  (test for errors, line 18)
> FAIL: g++.dg/template/instantiate3.C -std=c++98  (test for errors, line 13)
> FAIL: g++.dg/template/instantiate3.C -std=c++11  (test for errors, line 13)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 39)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 45)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 51)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 57)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 63)
> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 83)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for errors, line 107)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 119)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 120)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 121)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 122)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 123)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 124)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 127)
> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 131)
> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for errors, line 27)
> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for warnings, line 30)
> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for warnings, line 34)
> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for errors, line 27)
> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for warnings, line 30)
> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for warnings, line 34)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 14)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 22)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 31)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 40)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 14)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 22)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 31)
> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 40)
> FAIL: g++.dg/template/using16.C -std=c++98  (test for errors, line 14)
> FAIL: g++.dg/template/using16.C -std=c++98  (test for errors, line 25)
> FAIL: g++.dg/template/using16.C -std=c++98  (test for warnings, line 29)
> FAIL: g++.dg/template/using16.C -std=c++11  (test for errors, line 14)
> FAIL: g++.dg/template/using16.C -std=c++11  (test for errors, line 25)
> FAIL: g++.dg/template/using16.C -std=c++11  (test for warnings, line 29)
> FAIL: g++.dg/template/virtual3.C -std=c++98  (test for errors, line 8)
> FAIL: g++.dg/gomp/block-1.C -std=c++98  (test for warnings, line 7)
> FAIL: g++.dg/gomp/block-1.C -std=c++98  (test for warnings, line 9)
> FAIL: g++.dg/gomp/block-1.C -std=c++11  (test for warnings, line 7)
> FAIL: g++.dg/gomp/block-1.C -std=c++11  (test for warnings, line 9)
> FAIL: g++.dg/gomp/block-2.C -std=c++98  (test for warnings, line 14)
> FAIL: g++.dg/gomp/block-2.C -std=c++98  (test for warnings, line 16)
> FAIL: g++.dg/gomp/block-2.C -std=c++11  (test for warnings, line 14)
> FAIL: g++.dg/gomp/block-2.C -std=c++11  (test for warnings, line 16)
> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 21)
> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 26)
> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 30)
> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 21)
> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 26)
> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 30)
> FAIL: g++.dg/gomp/block-5.C -std=c++98  (test for warnings, line 7)
> FAIL: g++.dg/gomp/block-5.C -std=c++11  (test for warnings, line 7)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for errors, line 11)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for errors, line 29)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line 37)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line 40)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for errors, line 11)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for errors, line 29)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line 37)
> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line 40)
> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 9)
> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 28)
> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 38)
> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 9)
> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 28)
> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 38)
> FAIL: c-c++-common/tm/safe-3.c -std=gnu++98 (internal compiler error)
> FAIL: c-c++-common/tm/safe-3.c -std=gnu++98 (test for excess errors)
> FAIL: c-c++-common/tm/safe-3.c -std=gnu++11 (internal compiler error)
> FAIL: c-c++-common/tm/safe-3.c -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/tm/noexcept-2.C  (test for errors, line 7)
> FAIL: g++.dg/tm/noexcept-2.C  (test for errors, line 8)
> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++98  (test for errors, line 24)
> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++98  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++11  (test for errors, line 24)
> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++11  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++98  (test for warnings, line 36)
> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++98  (test for warnings, line 65)
> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++11  (test for warnings, line 36)
> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++11  (test for warnings, line 65)
> FAIL: g++.old-deja/g++.mike/net31.C -std=c++98  (test for errors, line 43)
> FAIL: g++.old-deja/g++.mike/net31.C -std=c++11  (test for errors, line 43)
> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++98  (test for errors, line 11)
> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++98  (test for errors, line 19)
> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++11  (test for errors, line 11)
> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++11  (test for errors, line 19)
> FAIL: g++.old-deja/g++.oliva/delete1.C -std=c++98  (test for warnings, line 31)
> FAIL: g++.old-deja/g++.other/friend1.C -std=c++98  (test for errors, line 63)
> FAIL: g++.old-deja/g++.other/friend1.C -std=c++98  (test for errors, line 82)
> FAIL: g++.old-deja/g++.other/friend1.C -std=c++11  (test for errors, line 63)
> FAIL: g++.old-deja/g++.other/friend1.C -std=c++11  (test for errors, line 82)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 13)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 17)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 18)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 13)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 17)
> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 18)
> FAIL: g++.old-deja/g++.other/lineno1.C -std=gnu++98  (test for errors, line 9)
> FAIL: g++.old-deja/g++.other/lineno1.C -std=gnu++11  (test for errors, line 9)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 pass (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 promote (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 pass (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 promote (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 30)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for errors, line 6)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for warnings, line 16)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for errors, line 6)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for warnings, line 16)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 no def (test for errors, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 inst (test for warnings, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 no def (test for errors, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 inst (test for warnings, line 43)
> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++98  (test for errors, line 36)
> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++11  (test for errors, line 36)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98  (test for errors, line 17)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98 inst (test for warnings, line 24)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11  (test for errors, line 17)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11 inst (test for warnings, line 24)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 45)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 47)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 51)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 52)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 56)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 45)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 47)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 51)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 52)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 56)
> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 56)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 pass (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 promote (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 pass (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 24)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 28)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 promote (test for warnings, line 30)
> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 30)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for errors, line 6)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for warnings, line 16)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for errors, line 6)
> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for warnings, line 16)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 no def (test for errors, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 inst (test for warnings, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 no def (test for errors, line 43)
> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 inst (test for warnings, line 43)
> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++98  (test for errors, line 36)
> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++11  (test for errors, line 36)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98  (test for errors, line 17)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98 inst (test for warnings, line 24)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11  (test for errors, line 17)
> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11 inst (test for warnings, line 24)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 45)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 47)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 51)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 52)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 56)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 45)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 47)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 51)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 52)
> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 56)
> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 56)
> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 58)
> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 60)
> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 62)
> FAIL: 20_util/unique_ptr/cons/ptr_deleter_neg.cc  (test for errors, line 37)
> FAIL: 20_util/unique_ptr/cons/ptr_deleter_neg.cc  (test for errors, line 47)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
  2012-03-26 20:56 [patch][RFC] bail out after front-end errors Steven Bosscher
@ 2012-03-27  7:17 ` Richard Guenther
  2012-03-27  9:50   ` Paolo Carlini
       [not found]   ` <CABu31nOcM81G89w4G2LKn0KoSNamLpgTO07YjZm=-9a94CQttA@mail.gmail.com>
  2012-03-27 19:00 ` Mike Stump
  1 sibling, 2 replies; 7+ messages in thread
From: Richard Guenther @ 2012-03-27  7:17 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Mailing List, GCC Patches

On Mon, Mar 26, 2012 at 10:56 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> This patch is one way to address PR44982. I see no good reason to
> cgraph_finalize_compilation_unit if there were parse errors. As Richi
> already pointed out, GCC traditionally has proceeded after parse
> errors to preserve warnings and errors we generate from the middle-end
> and during semantic analysis. But it seems to me that those warnings
> are not very meaningful after parse errors (-Wuninitialized after a
> parse error??), and errors from the middle end are mostly for exotic
> code (involving asm()s and the like). Bailing out after parse errors
> is therefore IMHO the right thing to do for the common case.
>
> Thoughts? Comments?

Conceptually it makes sense.  Did you check whether allowing the
FE too proceed to final_write_globals but stop before
cgraph_finalize_compilation_unit
preserves any errors?  I would expect that maybe FE global variable
diagostics are defered until that?  It would be nice to finally move
the call to cgraph_finalize_compilation_unit to the middle-end ...
(warning, if you try that you run into an issue with the Java frontend ... :/)

Richard.

> If the consensus is that this patch goes in, I'll also have to do some
> work on the test suite, because some warnings and errors disappear.
> List attached below. A lot of errors and warnings from g++ disappear.
> I suspect this is because they are only issued during gimplification.
> That is something I'll have to address before this patch could go in.
> Before I spend the effort, I'd like to know if there is consensus on
> the general direction proposed here... ;-)
>
> Ciao!
> Steven
>
>
>
> Index: toplev.c
> ===================================================================
> --- toplev.c    (revision 185813)
> +++ toplev.c    (working copy)
> @@ -561,9 +561,14 @@ compile_file (void)
>   /* Compilation is now finished except for writing
>      what's left of the symbol table output.  */
>
> -  if (flag_syntax_only || flag_wpa)
> +  /* If all we have to do is syntax checking, or if there were parse
> +     errors, stop here.  */
> +  if (flag_syntax_only || seen_error ())
>     return;
>
> +  if (flag_wpa)
> +    return;
> +
>   timevar_start (TV_PHASE_GENERATE);
>
>   ggc_protect_identifiers = false;
> @@ -571,12 +576,6 @@ compile_file (void)
>   /* This must also call cgraph_finalize_compilation_unit.  */
>   lang_hooks.decls.final_write_globals ();
>
> -  if (seen_error ())
> -    {
> -      timevar_stop (TV_PHASE_GENERATE);
> -      return;
> -    }
> -
>   /* Compilation unit is finalized.  When producing non-fat LTO object, we are
>      basically finished.  */
>   if (in_lto_p || !flag_lto || flag_fat_lto_objects)
>
>
> New failing tests:
>> FAIL: gcc.dg/asm-7.c  (test for errors, line 15)
>> FAIL: gcc.dg/asm-7.c  (test for errors, line 16)
>> FAIL: gcc.dg/declspec-10.c  (test for warnings, line 19)
>> FAIL: gcc.dg/declspec-11.c  (test for warnings, line 19)
>> FAIL: gcc.dg/declspec-9.c  (test for errors, line 20)
>> FAIL: gcc.dg/gnu99-static-1.c  (test for errors, line 21)
>> FAIL: gcc.dg/gnu99-static-1.c  (test for errors, line 25)
>> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 16)
>> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 40)
>> FAIL: gcc.dg/pr48552-1.c  (test for errors, line 52)
>> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 16)
>> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 40)
>> FAIL: gcc.dg/pr48552-2.c  (test for errors, line 52)
>> FAIL: gcc.dg/redecl-10.c  (test for warnings, line 15)
>> FAIL: gcc.dg/redecl-10.c  (test for warnings, line 29)
>> FAIL: gcc.dg/gomp/block-2.c  (test for errors, line 14)
>> FAIL: gcc.dg/gomp/block-2.c  (test for errors, line 16)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 9)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 10)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 11)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 15)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 16)
>> FAIL: gcc.dg/gomp/block-7.c  (test for errors, line 17)
>> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 9)
>> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 28)
>> FAIL: gcc.dg/gomp/pr27415.c  (test for errors, line 37)
>> FAIL: c-c++-common/tm/safe-3.c (internal compiler error)
>> FAIL: c-c++-common/tm/safe-3.c (test for excess errors)
>> FAIL: gcc.dg/tm/pr52141.c (internal compiler error)
>> FAIL: gcc.dg/tm/pr52141.c (test for excess errors)
>> FAIL: g++.dg/cpp0x/constexpr-ex1.C  (test for warnings, line 17)
>> FAIL: g++.dg/cpp0x/constexpr-function2.C  (test for warnings, line 46)
>> FAIL: g++.dg/cpp0x/constexpr-neg1.C  (test for warnings, line 5)
>> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C  (test for warnings, line 15)
>> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C not an aggregate (test for errors, line 16)
>> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C deleted default ctor (test for errors, line 17)
>> FAIL: g++.dg/cpp0x/lambda/lambda-ctor-neg.C deleted assignment op (test for errors, line 18)
>> FAIL: g++.dg/cpp0x/lambda/lambda-field-names.C no member named i (test for errors, line 11)
>> FAIL: g++.dg/cpp0x/noexcept15.C  (test for errors, line 16)
>> FAIL: g++.dg/cpp0x/pr47416.C  (test for errors, line 187)
>> FAIL: g++.dg/cpp0x/pr47416.C  (test for warnings, line 213)
>> FAIL: g++.dg/cpp0x/pr47416.C  (test for warnings, line 223)
>> FAIL: g++.dg/cpp0x/static_assert2.C  (test for errors, line 14)
>> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 17)
>> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 18)
>> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 28)
>> FAIL: g++.dg/cpp0x/union1.C  (test for errors, line 29)
>> FAIL: g++.dg/cpp0x/vt-37737-2.C  (test for warnings, line 4)
>> FAIL: g++.dg/cpp0x/vt-37737-2.C  (test for errors, line 6)
>> FAIL: g++.dg/cpp0x/vt-37737-2.C candidate note (test for warnings, line 6)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for errors, line 14)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for errors, line 15)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++98  (test for warnings, line 25)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for errors, line 14)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for errors, line 15)
>> FAIL: g++.dg/ext/case-range2.C -std=gnu++11  (test for warnings, line 25)
>> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for warnings, line 44)
>> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for warnings, line 46)
>> FAIL: g++.dg/init/pr42844.C -std=c++98  (test for errors, line 51)
>> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for warnings, line 44)
>> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for warnings, line 46)
>> FAIL: g++.dg/init/pr42844.C -std=c++11  (test for errors, line 51)
>> FAIL: g++.dg/parse/template18.C -std=c++98  (test for errors, line 47)
>> FAIL: g++.dg/parse/template18.C -std=c++98  (test for warnings, line 52)
>> FAIL: g++.dg/parse/template18.C -std=c++11  (test for errors, line 47)
>> FAIL: g++.dg/parse/template18.C -std=c++11  (test for warnings, line 52)
>> FAIL: g++.dg/parse/typename7.C -std=c++98  (test for warnings, line 10)
>> FAIL: g++.dg/parse/typename7.C -std=c++98  (test for warnings, line 11)
>> FAIL: g++.dg/parse/typename7.C -std=c++98 candidate note (test for warnings, line 12)
>> FAIL: g++.dg/parse/typename7.C -std=c++98 candidate note (test for warnings, line 22)
>> FAIL: g++.dg/parse/typename7.C -std=c++11  (test for warnings, line 10)
>> FAIL: g++.dg/parse/typename7.C -std=c++11  (test for warnings, line 11)
>> FAIL: g++.dg/parse/typename7.C -std=c++11 candidate note (test for warnings, line 12)
>> FAIL: g++.dg/parse/typename7.C -std=c++11 candidate note (test for warnings, line 22)
>> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for warnings, line 22)
>> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for errors, line 27)
>> FAIL: g++.dg/tc1/dr152.C -std=c++98 matching (test for errors, line 33)
>> FAIL: g++.dg/tc1/dr152.C -std=c++98 candidate note (test for warnings, line 33)
>> FAIL: g++.dg/tc1/dr152.C -std=c++98  (test for warnings, line 37)
>> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for warnings, line 22)
>> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for errors, line 27)
>> FAIL: g++.dg/tc1/dr152.C -std=c++11 matching (test for errors, line 33)
>> FAIL: g++.dg/tc1/dr152.C -std=c++11 candidate note (test for warnings, line 33)
>> FAIL: g++.dg/tc1/dr152.C -std=c++11  (test for warnings, line 37)
>> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 27)
>> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for warnings, line 35)
>> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 44)
>> FAIL: g++.dg/tc1/dr166.C -std=c++98  (test for errors, line 45)
>> FAIL: g++.dg/tc1/dr166.C -std=c++11  (test for warnings, line 50)
>> FAIL: g++.dg/template/access2.C -std=c++98  (test for errors, line 8)
>> FAIL: g++.dg/template/access2.C -std=c++98  (test for errors, line 13)
>> FAIL: g++.dg/template/access2.C -std=c++98  (test for warnings, line 19)
>> FAIL: g++.dg/template/access2.C -std=c++11  (test for errors, line 8)
>> FAIL: g++.dg/template/access2.C -std=c++11  (test for errors, line 13)
>> FAIL: g++.dg/template/access2.C -std=c++11  (test for warnings, line 19)
>> FAIL: g++.dg/template/crash107.C -std=gnu++98  (test for warnings, line 13)
>> FAIL: g++.dg/template/crash107.C -std=gnu++98  (test for warnings, line 20)
>> FAIL: g++.dg/template/crash107.C -std=gnu++11  (test for warnings, line 13)
>> FAIL: g++.dg/template/crash107.C -std=gnu++11  (test for warnings, line 20)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 86)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 110)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 110)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 112)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 112)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 115)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 115)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98  (test for errors, line 123)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++98 candidate note (test for warnings, line 123)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 110)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 110)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 112)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 112)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 115)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 115)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11  (test for errors, line 123)
>> FAIL: g++.dg/template/dependent-expr5.C -std=c++11 candidate note (test for warnings, line 123)
>> FAIL: g++.dg/template/error15.C -std=c++98  (test for errors, line 21)
>> FAIL: g++.dg/template/error15.C -std=c++11  (test for errors, line 21)
>> FAIL: g++.dg/template/error43.C -std=c++98  (test for warnings, line 9)
>> FAIL: g++.dg/template/error43.C -std=c++11  (test for warnings, line 9)
>> FAIL: g++.dg/template/friend31.C -std=c++98  (test for errors, line 13)
>> FAIL: g++.dg/template/friend31.C -std=c++98  (test for errors, line 18)
>> FAIL: g++.dg/template/friend31.C -std=c++11  (test for errors, line 13)
>> FAIL: g++.dg/template/friend31.C -std=c++11  (test for errors, line 18)
>> FAIL: g++.dg/template/instantiate3.C -std=c++98  (test for errors, line 13)
>> FAIL: g++.dg/template/instantiate3.C -std=c++11  (test for errors, line 13)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 39)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 45)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 51)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 57)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 63)
>> FAIL: g++.dg/template/memfriend7.C -std=c++98  (test for errors, line 83)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for errors, line 107)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 119)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 120)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 121)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 122)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 123)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 124)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 127)
>> FAIL: g++.dg/template/memfriend7.C -std=c++11  (test for warnings, line 131)
>> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for errors, line 27)
>> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for warnings, line 30)
>> FAIL: g++.dg/template/nontype12.C -std=c++98  (test for warnings, line 34)
>> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for errors, line 27)
>> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for warnings, line 30)
>> FAIL: g++.dg/template/nontype12.C -std=c++11  (test for warnings, line 34)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 14)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 22)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 31)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++98  (test for errors, line 40)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 14)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 22)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 31)
>> FAIL: g++.dg/template/pseudodtor3.C -std=c++11  (test for errors, line 40)
>> FAIL: g++.dg/template/using16.C -std=c++98  (test for errors, line 14)
>> FAIL: g++.dg/template/using16.C -std=c++98  (test for errors, line 25)
>> FAIL: g++.dg/template/using16.C -std=c++98  (test for warnings, line 29)
>> FAIL: g++.dg/template/using16.C -std=c++11  (test for errors, line 14)
>> FAIL: g++.dg/template/using16.C -std=c++11  (test for errors, line 25)
>> FAIL: g++.dg/template/using16.C -std=c++11  (test for warnings, line 29)
>> FAIL: g++.dg/template/virtual3.C -std=c++98  (test for errors, line 8)
>> FAIL: g++.dg/gomp/block-1.C -std=c++98  (test for warnings, line 7)
>> FAIL: g++.dg/gomp/block-1.C -std=c++98  (test for warnings, line 9)
>> FAIL: g++.dg/gomp/block-1.C -std=c++11  (test for warnings, line 7)
>> FAIL: g++.dg/gomp/block-1.C -std=c++11  (test for warnings, line 9)
>> FAIL: g++.dg/gomp/block-2.C -std=c++98  (test for warnings, line 14)
>> FAIL: g++.dg/gomp/block-2.C -std=c++98  (test for warnings, line 16)
>> FAIL: g++.dg/gomp/block-2.C -std=c++11  (test for warnings, line 14)
>> FAIL: g++.dg/gomp/block-2.C -std=c++11  (test for warnings, line 16)
>> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 21)
>> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 26)
>> FAIL: g++.dg/gomp/block-3.C -std=c++98  (test for warnings, line 30)
>> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 21)
>> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 26)
>> FAIL: g++.dg/gomp/block-3.C -std=c++11  (test for warnings, line 30)
>> FAIL: g++.dg/gomp/block-5.C -std=c++98  (test for warnings, line 7)
>> FAIL: g++.dg/gomp/block-5.C -std=c++11  (test for warnings, line 7)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for errors, line 11)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for errors, line 29)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line 37)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line 40)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for errors, line 11)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for errors, line 29)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line 37)
>> FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line 40)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 9)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 28)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++98  (test for errors, line 38)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 9)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 28)
>> FAIL: g++.dg/gomp/pr27415.C -std=c++11  (test for errors, line 38)
>> FAIL: c-c++-common/tm/safe-3.c -std=gnu++98 (internal compiler error)
>> FAIL: c-c++-common/tm/safe-3.c -std=gnu++98 (test for excess errors)
>> FAIL: c-c++-common/tm/safe-3.c -std=gnu++11 (internal compiler error)
>> FAIL: c-c++-common/tm/safe-3.c -std=gnu++11 (test for excess errors)
>> FAIL: g++.dg/tm/noexcept-2.C  (test for errors, line 7)
>> FAIL: g++.dg/tm/noexcept-2.C  (test for errors, line 8)
>> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++98  (test for errors, line 24)
>> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++98  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++11  (test for errors, line 24)
>> FAIL: g++.old-deja/g++.eh/spec6.C -std=c++11  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++98  (test for warnings, line 36)
>> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++98  (test for warnings, line 65)
>> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++11  (test for warnings, line 36)
>> FAIL: g++.old-deja/g++.jason/report.C -std=gnu++11  (test for warnings, line 65)
>> FAIL: g++.old-deja/g++.mike/net31.C -std=c++98  (test for errors, line 43)
>> FAIL: g++.old-deja/g++.mike/net31.C -std=c++11  (test for errors, line 43)
>> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++98  (test for errors, line 11)
>> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++98  (test for errors, line 19)
>> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++11  (test for errors, line 11)
>> FAIL: g++.old-deja/g++.niklas/t135.C -std=c++11  (test for errors, line 19)
>> FAIL: g++.old-deja/g++.oliva/delete1.C -std=c++98  (test for warnings, line 31)
>> FAIL: g++.old-deja/g++.other/friend1.C -std=c++98  (test for errors, line 63)
>> FAIL: g++.old-deja/g++.other/friend1.C -std=c++98  (test for errors, line 82)
>> FAIL: g++.old-deja/g++.other/friend1.C -std=c++11  (test for errors, line 63)
>> FAIL: g++.old-deja/g++.other/friend1.C -std=c++11  (test for errors, line 82)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 13)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++98  (test for errors, line 18)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 13)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.other/friend4.C -std=c++11  (test for errors, line 18)
>> FAIL: g++.old-deja/g++.other/lineno1.C -std=gnu++98  (test for errors, line 9)
>> FAIL: g++.old-deja/g++.other/lineno1.C -std=gnu++11  (test for errors, line 9)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 pass (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 promote (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 pass (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 promote (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for errors, line 6)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for warnings, line 16)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for errors, line 6)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for warnings, line 16)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 no def (test for errors, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 inst (test for warnings, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 no def (test for errors, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 inst (test for warnings, line 43)
>> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++98  (test for errors, line 36)
>> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++11  (test for errors, line 36)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98 inst (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11 inst (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 45)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 47)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 51)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 52)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 56)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 45)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 47)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 51)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 52)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 56)
>> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 56)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 pass (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 promote (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++98 abort (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 pass (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11  (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 28)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 promote (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.other/vaarg3.C -std=gnu++11 abort (test for warnings, line 30)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for errors, line 6)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++98  (test for warnings, line 16)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for errors, line 6)
>> FAIL: g++.old-deja/g++.pt/crash36.C -std=c++11  (test for warnings, line 16)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 no def (test for errors, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++98 inst (test for warnings, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 no def (test for errors, line 43)
>> FAIL: g++.old-deja/g++.pt/explicit70.C -std=c++11 inst (test for warnings, line 43)
>> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++98  (test for errors, line 36)
>> FAIL: g++.old-deja/g++.pt/instantiate8.C -std=c++11  (test for errors, line 36)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++98 inst (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11  (test for errors, line 17)
>> FAIL: g++.old-deja/g++.pt/vaarg3.C -std=c++11 inst (test for warnings, line 24)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 45)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 47)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 51)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 52)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++98  (test for errors, line 56)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 45)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 47)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 51)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 52)
>> FAIL: g++.old-deja/g++.robertl/eb109.C -std=c++11  (test for errors, line 56)
>> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 56)
>> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 58)
>> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 60)
>> FAIL: objc.dg/property/dotsyntax-17.m -fgnu-runtime  (test for errors, line 62)
>> FAIL: 20_util/unique_ptr/cons/ptr_deleter_neg.cc  (test for errors, line 37)
>> FAIL: 20_util/unique_ptr/cons/ptr_deleter_neg.cc  (test for errors, line 47)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
  2012-03-27  7:17 ` Richard Guenther
@ 2012-03-27  9:50   ` Paolo Carlini
       [not found]   ` <CABu31nOcM81G89w4G2LKn0KoSNamLpgTO07YjZm=-9a94CQttA@mail.gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Carlini @ 2012-03-27  9:50 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Steven Bosscher, GCC Mailing List, GCC Patches

Hi,
> On Mon, Mar 26, 2012 at 10:56 PM, Steven Bosscher<stevenb.gcc@gmail.com>  wrote:
>> Hello,
>>
>> This patch is one way to address PR44982. I see no good reason to
>> cgraph_finalize_compilation_unit if there were parse errors. As Richi
>> already pointed out, GCC traditionally has proceeded after parse
>> errors to preserve warnings and errors we generate from the middle-end
>> and during semantic analysis. But it seems to me that those warnings
>> are not very meaningful after parse errors (-Wuninitialized after a
>> parse error??), and errors from the middle end are mostly for exotic
>> code (involving asm()s and the like). Bailing out after parse errors
>> is therefore IMHO the right thing to do for the common case.
>>
>> Thoughts? Comments?
> Conceptually it makes sense.  Did you check whether allowing the
> FE too proceed to final_write_globals but stop before
> cgraph_finalize_compilation_unit
> preserves any errors?  I would expect that maybe FE global variable
> diagostics are defered until that?  It would be nice to finally move
> the call to cgraph_finalize_compilation_unit to the middle-end ...
> (warning, if you try that you run into an issue with the Java frontend ... :/)
I bet it does preserve some errors. I noticed that when I analyzed a bit 
PR40405, see Comment #3 in particular.

Thanks,
Paolo.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
  2012-03-26 20:56 [patch][RFC] bail out after front-end errors Steven Bosscher
  2012-03-27  7:17 ` Richard Guenther
@ 2012-03-27 19:00 ` Mike Stump
  2012-03-27 19:13   ` Steven Bosscher
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Stump @ 2012-03-27 19:00 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Mailing List, GCC Patches

On Mar 26, 2012, at 1:56 PM, Steven Bosscher wrote:
> This patch is one way to address PR44982.

That's a great idea, I like it.  There is only one problem that I know of that prevents it from going in now.  We emit errors/warnings from below finalize and there is a feature in which we emit all the reasonable error and warning messages that we can with one compile.  There is a certain class of power user that actually wants to see all the errors or warnings in a given compile, for them, this is a feature.  If you want to move the analysis for those to before finalize, then I think this is a good way to fix the problem, until then I think we should fix this in the normal way.  The usual way to fix this would be to find the bit that had the error_mark_node in it, and then do as much as you can, but, then to bubble up error_mark_node or otherwise end processing.

> I see no good reason to cgraph_finalize_compilation_unit if there were parse errors.

It is actually a feature people use, even if you don't have any users or your user base is too small to have ever met one.  I have.  The time the feature allows to be saved, can be measured in days and weeks.

> it seems to me that those warnings are not very meaningful after parse errors (-Wuninitialized after a
> parse error??),

But you're wrong.

int f = &sdf;

main() {
  int i;
  printf("%d", i);
}

is a program that has parse errors and certainly, any and all the errors after the first line that don't involve f in any meaningful way, are meaningful and valuable to some people.  I understand you don't see the value in them, that's all right.  They aren't valuable or meaningful to you, I get it.  But, are you willing to accept it when I assert that there is a class of people for which this is a feature, they are meaningful and valuable?

> and errors from the middle end are mostly for exotic
> code (involving asm()s and the like). Bailing out after parse errors
> is therefore IMHO the right thing to do for the common case.

Some are for very exotic things, yes, but not all of them.  Actually, I started reviewing them, none of them seem that exotic to me.  Take for example:

int f() { return this->i; }   // { dg-error "" "no member named i" } 

Really, exotic?

register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */

Again, I don't see the value in not giving the warning.

static int f2(void); /* { dg-error "used but never defined" } */

No exactly unheard of.

int x[]; /* { dg-warning "array 'x' assumed to have one element" } */

Gosh, seems reasonable.

	hash_unique_table (size_t n, hasher, key_equal,
                           value_allocator & a):table (n, a)    // { dg-error "is not a direct base" }   

This one I can see being nice to get with certain refactoring operations on large code bases.

  static_assert( I % 2 == 1, "I must be an odd number"); // { dg-error "odd number" }                    

What, you mean my static_asserts are gonna go away, but we _liked_ them.

    case low ... high : return i + 1;  // { dg-error "previously" }                                      
    case 5 : return i + 2;             // { dg-error "duplicate" }                                       

duplicate case statements, awe...  What's next?

  void Look(W& w) { w.x = 3; }          // { dg-error "private within this context" }

Bye bye access control, I guess it was overrated.

I was going to go through them all, but I have to stop now, my stomach doesn't feel well.  I was only 38% of the way though them.  Did you actually review them, all of them?

What is so very wrong with fixing this in the normal way?  I can envision beefier analysis and code checking that runs very late in the compilation process in order to get the most accurate analysis out of it.  It seems reasonable to permit that, even in the presence of parse errors, for all  the same reasons we want to see that a case statement was a duplicate, or that something was never defined.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
  2012-03-27 19:00 ` Mike Stump
@ 2012-03-27 19:13   ` Steven Bosscher
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Bosscher @ 2012-03-27 19:13 UTC (permalink / raw)
  To: Mike Stump; +Cc: GCC Mailing List, GCC Patches

On Tue, Mar 27, 2012 at 8:59 PM, Mike Stump <mikestump@comcast.net> wrote:
>> and errors from the middle end are mostly for exotic
>> code (involving asm()s and the like). Bailing out after parse errors
>> is therefore IMHO the right thing to do for the common case.
>
> Some are for very exotic things, yes, but not all of them.  Actually, I started reviewing them, none of them seem that exotic to me.  Take for example:
>
> int f() { return this->i; }   // { dg-error "" "no member named i" }
>
> Really, exotic?

I expect it is not difficult to retain almost all of these C++ errors
by lowering (i.e. gimplifying) in the front end, or by having some
intermediate stage. It certainly wouldn't be acceptable to loose all
those diagnostics, just like that. I'm trying to figure out how to
avoid that! But it seemed prudent to ask what other people think of
this kind of change before spending loads of time on it  :-)
Thanks for your comments!

Ciao!
Steven

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
       [not found]     ` <CAFiYyc0S4358PFGyzJjqe_Uw=H-DmGH4n+C=AvO1Xx-nQOLD9A@mail.gmail.com>
@ 2012-12-28 17:36       ` Steven Bosscher
  2013-01-02 15:07         ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Bosscher @ 2012-12-28 17:36 UTC (permalink / raw)
  To: Richard Guenther, Jan Hubicha; +Cc: GCC Mailing List, GCC Patches list

On Tue, Mar 27, 2012 at 10:59 AM, Richard Guenther wrote:
> On Tue, Mar 27, 2012 at 10:32 AM, Steven Bosscher  wrote:
>> On Tue, Mar 27, 2012 at 9:17 AM, Richard Guenther wrote:
>>> It would be nice to finally move
>>> the call to cgraph_finalize_compilation_unit to the middle-end ...
>>> (warning, if you try that you run into an issue with the Java frontend ... :/)
>>
>> Do you remember what issues that causes? I'm running into a great
>> number of issues there already with some varasm fixes (basically just
>> cleanups for the tree-ssa and unit-at-a-time era we're supposed to
>> live in - except Java).
>
> I think it was the
>
>   /* Generate hidden aliases for Java.  */
>   if (candidates)
>     {
>       build_java_method_aliases (candidates);
>       pointer_set_destroy (candidates);
>     }
>
> hunk in cp_write_global_declarations that does not work when run
> before cgraph_finalize_compilation_unit
> (I simply tried to move that call out of, and after calling the
> langhook).  So the problem materialized when
> building libjava I think.

Hello,

Coming back to this issue...  Attached patch is an attempt to resolve
this part of the finalize_compilation_unit problem. Instead of
emitting aliases with assemble_alias after finalize_compilation_unit,
this patch uses cgraph_same_body_alias before it.

Bootstrapped&tested on powerpc64-unknown-linux-gnu.
Richi, Honza, does this make sense?

Ciao!
Steven

cp/
	* decl2.c (collect_candidates_for_java_method_aliases): Remove.
	(build_java_method_aliases): Rewrite to emit the aliases via the
	cgraphunit machinery.
	(cp_write_global_declarations): Adjust for abovementioned changes.

Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 194725)
+++ cp/decl2.c	(working copy)
stevenb@stevenb-laptop:~$ cat devel/java_method_aliases.diff
cp/
	* decl2.c (collect_candidates_for_java_method_aliases): Remove.
	(build_java_method_aliases): Rewrite to emit the aliases via the
	cgraphunit machinery.
	(cp_write_global_declarations): Adjust for abovementioned changes.

Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 194725)
+++ cp/decl2.c	(working copy)
@@ -3615,79 +3615,53 @@ generate_ctor_and_dtor_functions_for_priority (spl

 /* Java requires that we be able to reference a local address for a
    method, and not be confused by PLT entries.  If hidden aliases are
-   supported, collect and return all the functions for which we should
+   supported, emit one for each java function that we've emitted.
    emit a hidden alias.  */

-static struct pointer_set_t *
-collect_candidates_for_java_method_aliases (void)
+static void
+build_java_method_aliases (void)
 {
+#ifdef HAVE_GAS_HIDDEN
   struct cgraph_node *node;
-  struct pointer_set_t *candidates = NULL;
+  tree fndecl;
+  vec<tree> candidates = vNULL;
+  unsigned int ix;

-#ifndef HAVE_GAS_HIDDEN
-  return candidates;
-#endif
-
+  /* First collect all candidates.  We cannot create the aliases
+     in place, it confuses the FOR_EACH_FUNCTION iterator.  */
   FOR_EACH_FUNCTION (node)
     {
-      tree fndecl = node->symbol.decl;
-
+      fndecl = node->symbol.decl;
       if (DECL_CONTEXT (fndecl)
 	  && TYPE_P (DECL_CONTEXT (fndecl))
 	  && TYPE_FOR_JAVA (DECL_CONTEXT (fndecl))
 	  && TARGET_USE_LOCAL_THUNK_ALIAS_P (fndecl))
-	{
-	  if (candidates == NULL)
-	    candidates = pointer_set_create ();
-	  pointer_set_insert (candidates, fndecl);
-	}
+	candidates.safe_push (fndecl);
     }

-  return candidates;
-}
-
-
-/* Java requires that we be able to reference a local address for a
-   method, and not be confused by PLT entries.  If hidden aliases are
-   supported, emit one for each java function that we've emitted.
-   CANDIDATES is the set of FUNCTION_DECLs that were gathered
-   by collect_candidates_for_java_method_aliases.  */
-
-static void
-build_java_method_aliases (struct pointer_set_t *candidates)
-{
-  struct cgraph_node *node;
-
-#ifndef HAVE_GAS_HIDDEN
-  return;
-#endif
-
-  FOR_EACH_FUNCTION (node)
+  /* Now add the aliases for the candidates collected above.
+     Mangle the name in a predictable way; we need to reference
+     this from a java compiled object file.  */
+  FOR_EACH_VEC_ELT (candidates, ix, fndecl)
     {
-      tree fndecl = node->symbol.decl;
+      tree oid, nid, alias;
+      const char *oname;
+      char *nname;

-      if (TREE_ASM_WRITTEN (fndecl)
-	  && pointer_set_contains (candidates, fndecl))
-	{
-	  /* Mangle the name in a predictable way; we need to reference
-	     this from a java compiled object file.  */
-	  tree oid, nid, alias;
-	  const char *oname;
-	  char *nname;
+      oid = DECL_ASSEMBLER_NAME (fndecl);
+      oname = IDENTIFIER_POINTER (oid);
+      gcc_assert (oname[0] == '_' && oname[1] == 'Z');
+      nname = ACONCAT (("_ZGA", oname+2, NULL));
+      nid = get_identifier (nname);

-	  oid = DECL_ASSEMBLER_NAME (fndecl);
-	  oname = IDENTIFIER_POINTER (oid);
-	  gcc_assert (oname[0] == '_' && oname[1] == 'Z');
-	  nname = ACONCAT (("_ZGA", oname+2, NULL));
-	  nid = get_identifier (nname);
-
-	  alias = make_alias_for (fndecl, nid);
-	  TREE_PUBLIC (alias) = 1;
-	  DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN;
-
-	  assemble_alias (alias, oid);
-	}
+      alias = make_alias_for (fndecl, nid);
+      TREE_PUBLIC (alias) = 1;
+      DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN;
+      node = cgraph_same_body_alias (NULL, alias, fndecl);
+      gcc_assert (node);
     }
+#endif
+  return;
 }

 /* Return C++ property of T, based on given operation OP.  */
@@ -3933,7 +3907,6 @@ cp_write_global_declarations (void)
   unsigned ssdf_count = 0;
   int retries = 0;
   tree decl;
-  struct pointer_set_t *candidates;

   locus = input_location;
   at_eof = 1;
@@ -4282,8 +4255,8 @@ cp_write_global_declarations (void)
      linkage now.  */
   pop_lang_context ();

-  /* Collect candidates for Java hidden aliases.  */
-  candidates = collect_candidates_for_java_method_aliases ();
+  /* Generate hidden aliases for Java.  */
+  build_java_method_aliases ();

   timevar_stop (TV_PHASE_DEFERRED);
   timevar_start (TV_PHASE_OPT_GEN);
@@ -4306,13 +4279,6 @@ cp_write_global_declarations (void)

   perform_deferred_noexcept_checks ();

-  /* Generate hidden aliases for Java.  */
-  if (candidates)
-    {
-      build_java_method_aliases (candidates);
-      pointer_set_destroy (candidates);
-    }
-
   finish_repo ();

   /* The entire file is now complete.  If requested, dump everything

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch][RFC] bail out after front-end errors
  2012-12-28 17:36       ` Steven Bosscher
@ 2013-01-02 15:07         ` Richard Biener
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Biener @ 2013-01-02 15:07 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: Jan Hubicha, GCC Mailing List, GCC Patches list

On Fri, Dec 28, 2012 at 6:35 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Tue, Mar 27, 2012 at 10:59 AM, Richard Guenther wrote:
>> On Tue, Mar 27, 2012 at 10:32 AM, Steven Bosscher  wrote:
>>> On Tue, Mar 27, 2012 at 9:17 AM, Richard Guenther wrote:
>>>> It would be nice to finally move
>>>> the call to cgraph_finalize_compilation_unit to the middle-end ...
>>>> (warning, if you try that you run into an issue with the Java frontend ... :/)
>>>
>>> Do you remember what issues that causes? I'm running into a great
>>> number of issues there already with some varasm fixes (basically just
>>> cleanups for the tree-ssa and unit-at-a-time era we're supposed to
>>> live in - except Java).
>>
>> I think it was the
>>
>>   /* Generate hidden aliases for Java.  */
>>   if (candidates)
>>     {
>>       build_java_method_aliases (candidates);
>>       pointer_set_destroy (candidates);
>>     }
>>
>> hunk in cp_write_global_declarations that does not work when run
>> before cgraph_finalize_compilation_unit
>> (I simply tried to move that call out of, and after calling the
>> langhook).  So the problem materialized when
>> building libjava I think.
>
> Hello,
>
> Coming back to this issue...  Attached patch is an attempt to resolve
> this part of the finalize_compilation_unit problem. Instead of
> emitting aliases with assemble_alias after finalize_compilation_unit,
> this patch uses cgraph_same_body_alias before it.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu.
> Richi, Honza, does this make sense?

Looks sensible to me.  In theory it should even allow more optimizations
this way ...

Of course it looks like stage1 material.

Thanks,
Richard.

> Ciao!
> Steven
>
> cp/
>         * decl2.c (collect_candidates_for_java_method_aliases): Remove.
>         (build_java_method_aliases): Rewrite to emit the aliases via the
>         cgraphunit machinery.
>         (cp_write_global_declarations): Adjust for abovementioned changes.
>
> Index: cp/decl2.c
> ===================================================================
> --- cp/decl2.c  (revision 194725)
> +++ cp/decl2.c  (working copy)
> stevenb@stevenb-laptop:~$ cat devel/java_method_aliases.diff
> cp/
>         * decl2.c (collect_candidates_for_java_method_aliases): Remove.
>         (build_java_method_aliases): Rewrite to emit the aliases via the
>         cgraphunit machinery.
>         (cp_write_global_declarations): Adjust for abovementioned changes.
>
> Index: cp/decl2.c
> ===================================================================
> --- cp/decl2.c  (revision 194725)
> +++ cp/decl2.c  (working copy)
> @@ -3615,79 +3615,53 @@ generate_ctor_and_dtor_functions_for_priority (spl
>
>  /* Java requires that we be able to reference a local address for a
>     method, and not be confused by PLT entries.  If hidden aliases are
> -   supported, collect and return all the functions for which we should
> +   supported, emit one for each java function that we've emitted.
>     emit a hidden alias.  */
>
> -static struct pointer_set_t *
> -collect_candidates_for_java_method_aliases (void)
> +static void
> +build_java_method_aliases (void)
>  {
> +#ifdef HAVE_GAS_HIDDEN
>    struct cgraph_node *node;
> -  struct pointer_set_t *candidates = NULL;
> +  tree fndecl;
> +  vec<tree> candidates = vNULL;
> +  unsigned int ix;
>
> -#ifndef HAVE_GAS_HIDDEN
> -  return candidates;
> -#endif
> -
> +  /* First collect all candidates.  We cannot create the aliases
> +     in place, it confuses the FOR_EACH_FUNCTION iterator.  */
>    FOR_EACH_FUNCTION (node)
>      {
> -      tree fndecl = node->symbol.decl;
> -
> +      fndecl = node->symbol.decl;
>        if (DECL_CONTEXT (fndecl)
>           && TYPE_P (DECL_CONTEXT (fndecl))
>           && TYPE_FOR_JAVA (DECL_CONTEXT (fndecl))
>           && TARGET_USE_LOCAL_THUNK_ALIAS_P (fndecl))
> -       {
> -         if (candidates == NULL)
> -           candidates = pointer_set_create ();
> -         pointer_set_insert (candidates, fndecl);
> -       }
> +       candidates.safe_push (fndecl);
>      }
>
> -  return candidates;
> -}
> -
> -
> -/* Java requires that we be able to reference a local address for a
> -   method, and not be confused by PLT entries.  If hidden aliases are
> -   supported, emit one for each java function that we've emitted.
> -   CANDIDATES is the set of FUNCTION_DECLs that were gathered
> -   by collect_candidates_for_java_method_aliases.  */
> -
> -static void
> -build_java_method_aliases (struct pointer_set_t *candidates)
> -{
> -  struct cgraph_node *node;
> -
> -#ifndef HAVE_GAS_HIDDEN
> -  return;
> -#endif
> -
> -  FOR_EACH_FUNCTION (node)
> +  /* Now add the aliases for the candidates collected above.
> +     Mangle the name in a predictable way; we need to reference
> +     this from a java compiled object file.  */
> +  FOR_EACH_VEC_ELT (candidates, ix, fndecl)
>      {
> -      tree fndecl = node->symbol.decl;
> +      tree oid, nid, alias;
> +      const char *oname;
> +      char *nname;
>
> -      if (TREE_ASM_WRITTEN (fndecl)
> -         && pointer_set_contains (candidates, fndecl))
> -       {
> -         /* Mangle the name in a predictable way; we need to reference
> -            this from a java compiled object file.  */
> -         tree oid, nid, alias;
> -         const char *oname;
> -         char *nname;
> +      oid = DECL_ASSEMBLER_NAME (fndecl);
> +      oname = IDENTIFIER_POINTER (oid);
> +      gcc_assert (oname[0] == '_' && oname[1] == 'Z');
> +      nname = ACONCAT (("_ZGA", oname+2, NULL));
> +      nid = get_identifier (nname);
>
> -         oid = DECL_ASSEMBLER_NAME (fndecl);
> -         oname = IDENTIFIER_POINTER (oid);
> -         gcc_assert (oname[0] == '_' && oname[1] == 'Z');
> -         nname = ACONCAT (("_ZGA", oname+2, NULL));
> -         nid = get_identifier (nname);
> -
> -         alias = make_alias_for (fndecl, nid);
> -         TREE_PUBLIC (alias) = 1;
> -         DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN;
> -
> -         assemble_alias (alias, oid);
> -       }
> +      alias = make_alias_for (fndecl, nid);
> +      TREE_PUBLIC (alias) = 1;
> +      DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN;
> +      node = cgraph_same_body_alias (NULL, alias, fndecl);
> +      gcc_assert (node);
>      }
> +#endif
> +  return;
>  }
>
>  /* Return C++ property of T, based on given operation OP.  */
> @@ -3933,7 +3907,6 @@ cp_write_global_declarations (void)
>    unsigned ssdf_count = 0;
>    int retries = 0;
>    tree decl;
> -  struct pointer_set_t *candidates;
>
>    locus = input_location;
>    at_eof = 1;
> @@ -4282,8 +4255,8 @@ cp_write_global_declarations (void)
>       linkage now.  */
>    pop_lang_context ();
>
> -  /* Collect candidates for Java hidden aliases.  */
> -  candidates = collect_candidates_for_java_method_aliases ();
> +  /* Generate hidden aliases for Java.  */
> +  build_java_method_aliases ();
>
>    timevar_stop (TV_PHASE_DEFERRED);
>    timevar_start (TV_PHASE_OPT_GEN);
> @@ -4306,13 +4279,6 @@ cp_write_global_declarations (void)
>
>    perform_deferred_noexcept_checks ();
>
> -  /* Generate hidden aliases for Java.  */
> -  if (candidates)
> -    {
> -      build_java_method_aliases (candidates);
> -      pointer_set_destroy (candidates);
> -    }
> -
>    finish_repo ();
>
>    /* The entire file is now complete.  If requested, dump everything

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-02 15:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 20:56 [patch][RFC] bail out after front-end errors Steven Bosscher
2012-03-27  7:17 ` Richard Guenther
2012-03-27  9:50   ` Paolo Carlini
     [not found]   ` <CABu31nOcM81G89w4G2LKn0KoSNamLpgTO07YjZm=-9a94CQttA@mail.gmail.com>
     [not found]     ` <CAFiYyc0S4358PFGyzJjqe_Uw=H-DmGH4n+C=AvO1Xx-nQOLD9A@mail.gmail.com>
2012-12-28 17:36       ` Steven Bosscher
2013-01-02 15:07         ` Richard Biener
2012-03-27 19:00 ` Mike Stump
2012-03-27 19:13   ` Steven Bosscher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).