This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to fix -fsyntax-only


Here's my patch to fix -fsyntax-only.  The new lines fix the ICEs;
the changed lines help eliminate spurious warnings when compiling
using `-W -Wall -fsyntax-only', by leaving inhibiting of output
to the lower layers (which the new lines fix).

I've done a bootstrap build with this patch in place -- same results
as without it (aside from changes of line numbers for warnings
in the patched source, naturally).

Ok to commit?

Java people -- I take it you have a specifical functional need
for -fsyntax-only working properly, and probably make use of
areas of the front end that g77 doesn't.  (I've been testing
`-W -Wall -fsyntax-only' on my private g77 test suite for awhile,
which is how I noticed the new bug.)

So, if you have tests above and beyond what appear in (and get
run by `make check') the egcs/gcc/testsuite, give them a try if
you have a chance.  Send me any newly failing test cases if you
find any; I'll be happy to try to fix them, though the quick
fix is likely to be withholding the stmt.c patchlet below.

        tq vm, (burley)


Thu Feb 18 17:05:11 1999  Craig Burley  <craig@jcb-sc.com>

	Fix -fsyntax-only (fix ICEs, decrease spurious warnings):
	* stmt.c (expand_expr_stmt): Expand expr even when -fsyntax-only.
	* varasm.c (assemble_zeros, assemble_variable,
	output_constant_def): Do nothing when -fsyntax-only.

*** g77-e/gcc/stmt.c.~1~	Mon Feb 15 20:43:56 1999
--- g77-e/gcc/stmt.c	Thu Feb 18 14:46:01 1999
*************** expand_expr_stmt (exp)
*** 1693,1703 ****
  
    last_expr_type = TREE_TYPE (exp);
!   if (flag_syntax_only && ! expr_stmts_for_value)
!     last_expr_value = 0;
!   else
!     last_expr_value = expand_expr (exp,
! 				   (expr_stmts_for_value
! 				    ? NULL_RTX : const0_rtx),
! 				   VOIDmode, 0);
  
    /* If all we do is reference a volatile value in memory,
--- 1693,1700 ----
  
    last_expr_type = TREE_TYPE (exp);
!   last_expr_value = expand_expr (exp,
! 				 (expr_stmts_for_value
! 				  ? NULL_RTX : const0_rtx),
! 				 VOIDmode, 0);
  
    /* If all we do is reference a volatile value in memory,
*** g77-e/gcc/varasm.c.~1~	Thu Feb 11 21:39:32 1999
--- g77-e/gcc/varasm.c	Thu Feb 18 14:49:21 1999
*************** assemble_zeros (size)
*** 1063,1066 ****
--- 1063,1070 ----
       int size;
  {
+   /* Do no output if -fsyntax-only.  */
+   if (flag_syntax_only)
+     return;
+ 
  #ifdef ASM_NO_SKIP_IN_TEXT
    /* The `space' pseudo in the text section outputs nop insns rather than 0s,
*************** assemble_variable (decl, top_level, at_e
*** 1158,1161 ****
--- 1162,1169 ----
    enum in_section saved_in_section;
  
+   /* Do no output if -fsyntax-only.  */
+   if (flag_syntax_only)
+     return;
+ 
    last_assemble_variable_decl = 0;
  
*************** output_constant_def (exp)
*** 3017,3021 ****
  	    }
  	}
!       else
  	output_constant_def_contents (exp, reloc, const_labelno++);
      }
--- 3025,3030 ----
  	    }
  	}
!       /* Do no output if -fsyntax-only.  */
!       else if (! flag_syntax_only)
  	output_constant_def_contents (exp, reloc, const_labelno++);
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]