SYMBOL_REF_FLAGS
Richard Sandiford
rdsandiford@googlemail.com
Thu May 15 06:37:00 GMT 2014
David Edelsohn <dje.gcc@gmail.com> writes:
> Richard,
>
> Your SYMBOL_REF_FLAGS RTX patches broke bootstrap on AIX.
>
> - David
>
> /nasfarm/edelsohn/src/src/libgcc/libgcc2.c: In function '__eprintf':
> /nasfarm/edelsohn/src/src/libgcc/libgcc2.c:2126:1: internal compiler error: RTL
> flag check: SYMBOL_REF_FLAGS used with unexpected rtx code 'const' in
> rs6000_delegitimize_address, at config/rs6000/rs6000.c:6863
OK, that's:
/* Do not associate thread-local symbols with the original
constant pool symbol. */
if (TARGET_XCOFF
&& GET_CODE (y) == SYMBOL_REF
&& CONSTANT_POOL_ADDRESS_P (y)
&& SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) >= TLS_MODEL_REAL)
return orig_x;
get_pool_constant can return general constants, not just SYMBOL_REFs,
so the code does look wrong. In the particular case of CONST flagged up
in the message, SYMBOL_REF_TLS_MODEL would read beyond the end of the rtx.
I think you would have seen the same failure before the patch with
--enable-checking=yes,rtl.
The reason my patch broke the bootstrap is that SYMBOL_REF_FLAGS now
checks based on ENABLE_RTL_FLAG_CHECKING rather than ENABLE_RTL_CHECKING.
I'd done that because u2 is part of the header and so checking it felt
more like checking a flag than the format. Perhaps that was a bad
idea though, since it will slow down --enable-checking=yes (but not
--enable-checking=release) compilers. OTOH it will catch things like
this. I can switch it back if that seems better.
Does the patch below fix things?
Thanks,
Richard
gcc/
* config/rs6000/rs600.c (rs6000_real_tls_symbol_ref_p): New function.
(rs6000_delegitimize_address): Use it.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c 2014-05-15 07:29:15.103636841 +0100
+++ gcc/config/rs6000/rs6000.c 2014-05-15 07:30:54.504504200 +0100
@@ -6803,6 +6803,16 @@ rs6000_output_dwarf_dtprel (FILE *file,
fputs ("@dtprel+0x8000", file);
}
+/* Return true if X is a symbol that refers to real (rather than emulated)
+ TLS. */
+
+static bool
+rs6000_real_tls_symbol_ref_p (rtx x)
+{
+ return (GET_CODE (x) == SYMBOL_REF
+ && SYMBOL_REF_TLS_MODEL (x) >= TLS_MODEL_REAL);
+}
+
/* In the name of slightly smaller debug output, and to cater to
general assembler lossage, recognize various UNSPEC sequences
and turn them back into a direct symbol reference. */
@@ -6860,7 +6870,7 @@ rs6000_delegitimize_address (rtx orig_x)
if (TARGET_XCOFF
&& GET_CODE (y) == SYMBOL_REF
&& CONSTANT_POOL_ADDRESS_P (y)
- && SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) >= TLS_MODEL_REAL)
+ && rs6000_real_tls_symbol_ref_p (get_pool_constant (y)))
return orig_x;
#endif
More information about the Gcc-patches
mailing list