This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Strings
On 25 March 2011 05:10, Ian Lance Taylor <iant@google.com> wrote:
> Philip Herron <redbrain@gcc.gnu.org> writes:
>
>> Program received signal SIGSEGV, Segmentation fault.
>> useless_type_conversion_p (outer_type=0xb7ac1f60,
>> inner_type=0xafafafaf) at ../../gcc-dev/gcc/tree-ssa.c:1222
>> 1222 ? ?if (POINTER_TYPE_P (inner_type)
>
> The inner_type parameter is garbage. ?The value 0xafafafaf indicates
> that it was garbage collected. ?Somewhere you are holding on to a
> pointer which the garbage collector is not seeing.
>
> Ian
>
Ah i have it working now i had some stupid messy VEC being used as
tree's because i was up far too late. I was able to just reuse the
c-decl.c example: but i have to use:
TREE_STATIC (address) = 1;
TREE_READONLY (address) = 1;
DECL_ARTIFICIAL (address) = 1;
on the tmp_var or i get some error when it comes to varasm.c
So basically i had to:
tree type = build_array_type (char_type_node,
build_index_type (size_int (
IDENTIFIER_LENGTH (DECL_NAME(decl))
)));
type = build_qualified_type (type, TYPE_QUAL_CONST);
gpy_preserve_from_gc (type);
tree str = build_string (IDENTIFIER_LENGTH (DECL_NAME(decl)), c_ident);
TREE_TYPE (str) = type;
Then MODIFY_EXPR with a tmp_var assigned to str; and i can use that
tmp_var to access the string.
Thanks Ian!