Strings
Ian Lance Taylor
iant@google.com
Wed Mar 23 21:36:00 GMT 2011
Philip Herron <redbrain@gcc.gnu.org> writes:
> In function ‘foo’:
> gpy1: internal compiler error: output_operand: invalid expression as operand
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
> I spent quite a while trying to trace it from when
> cgraph_finalize_compilation_unit () and it comes down to:
You will get farther if you set a breakpoint on fancy_abort and on
internal_error and get a backtrace from that point.
> Example of where this string code is being used is
>
> const char * c_ident = IDENTIFIER_POINTER(DECL_NAME(decl));
>
> tree str = build_string (strlen (c_ident), c_ident);
You can use IDENTIFIER_LENGTH rather than strlen.
> TREE_TYPE (str) = gpy_const_char_ptr;
> tree ident = build_fold_addr_expr (str);
>
> return build_call_expr (gpy_rr_decl, 3,
> build_fold_addr_expr (decl),
> build_int_cst (integer_type_node, n),
> ident);
You may need to put the address in a variable rather than using it
directly. I'm not sure offhand.
Ian
More information about the Gcc-help
mailing list