This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: Local variables


Hello

I have another question related to this. Lets suppose we have declared
a local integer variable and we assigned some integer to it using
gimple_build_assign statement (providing an ssa name). And after this,
I want to modify the value of same variable. Should I create an other
assignment statement or is there any other way to it?

I have already tested it with creating an other assignment statement
by providing the same ssa name but it gives me an error:
hello.c:3:5: error: SSA_NAME_DEF_STMT is wrong
Expected definition statement:
b_4 = 1234;

Actual definition statement:
b_4 = 5555;
hello.c:3:5: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Any help will be very useful.

Regards

Abdul

On Tue, Jun 28, 2011 at 11:41 AM, Abdul Wahid Memon
<engrwahidmemon@gmail.com> wrote:
> Thanks alot. That resolved the problem.
>
> Regards
>
> Abdul
>
> On Tue, Jun 28, 2011 at 12:13 AM, Ian Lance Taylor <iant@google.com> wrote:
>> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>>
>>> I am trying to create a simple integer type variable at GIMPLE level
>>> using the following code.
>>>
>>> tree var_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL,
>>> get_identifier("aflatoon"), integer_type_node);
>>> ? DECL_ARTIFICIAL (var_decl) = 1;
>>> ? TREE_PUBLIC (var_decl) = 1;
>>> ? TREE_USED (var_decl) = 1;
>>> ? TREE_STATIC (var_decl) = 1;
>>> ? DECL_INITIAL (var_decl) = build_int_cst(integer_type_node, 12345);
>>>
>>> stmt = gimple_build_bind(var_decl, cfun->gimple_body, NULL );
>>> gsi_insert_before(&gsi, stmt, GSI_SAME_STMT);
>>>
>>> But I am always getting the following error.
>>>
>>> hello.c:3:5: error: invalid GIMPLE statement
>>> {
>>> ? static int aflatoon = 12345;
>>>
>>>
>>> }
>>>
>>> hello.c:3:5: internal compiler error: in verify_types_in_gimple_stmt,
>>> at tree-cfg.c:4047
>>> Please submit a full bug report,
>>> with preprocessed source if appropriate.
>>> See <http://gcc.gnu.org/bugs.html> for instructions.
>>>
>>> I have checked verify_type_in_gimple_stmt and it is returning true as
>>> the stmt that is being given is of type GIMPLE_BIND
>>> which is not there.
>>>
>>> One more thing, I want to declare this local variable right at the
>>> starting of main function definition but I am unable to do it. Any
>>> help will be useful.
>>
>> Setting TREE_STATIC to 1 means that this is a file static variable, not
>> a function local variable. ?Which one do you want?
>>
>> If you want the file static variable, then you should not be calling
>> gimple_build_bind. ?If you want a function local variable, then you
>> should not be setting TREE_STATIC.
>>
>> Ian
>>
>


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