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 : [gcc front end] problem with -O* flags



Hello,

Thank you very much Andi and Philip for your help.
It was not a problem of trunk, it comes from the build_function_type_list() 
function use.
In  fact, when I call my operation(), I need the instance to add to the  
argument list, (I used tree code defined in tree.def for C to call a  function).
however, when I build the operation type I did not add this argument.

tree myOperation1_type = build_function_type_list(void_type_node, NULL_TREE);    


and I call it with an argument (the class instance)

tree target_ptr = build1(ADDR_EXPR, 
build_pointer_type(TREE_TYPE(x_tree)),x_tree);

tree call_myOperation1 = build_call_expr(myOperation1_tree,1, target_ptr); 

that's why when I try to modify the MyAttribute (using the argument) I get a seg 
fault.

When I modify the build_function_type_list call with this one:

tree __arg0_type = build_pointer_type(myClass_type);

tree myOperation1_type = build_function_type_list(void_type_node, __arg0_type, 
NULL_TREE);

I get no more error when compiling using -Os :)

but the question to ask here, why this did not cause a problem when compiling 
without -Os ?

thank you very much :)

Asma



________________________________
De : Andi Hellmund <mail@andihellmund.com>
À : Philip Herron <redbrain@gcc.gnu.org>
Cc : charfi asma <charfiasma@yahoo.fr>; gcc-help@gcc.gnu.org
Envoyé le : Lun 20 juin 2011, 0h 59min 57s
Objet : Re: [gcc front end] problem with -O* flags

Hey Asma,
> To be fair it could be a problem with the gcc sources your compiling
> with that was maybe fixed in the next commit or something.
I agree with Phil that your GENERIC code looks good. Just for future postings, 
whenever you face a segmentation fault and you are unsure about the root cause 
of the fault, it would be beneficial to always list the GCC version (e.g. 4.6.0, 

trunk) that you faced your problems with. By knowing the exact version, we would 

possibly be able to reproduce your problems somehow.

So, which version of GCC are you facing your problems with?
> git add remote gcc git://gcc.gnu.org/git/gcc.git
> git fetch gcc
> git merge gcc/master
> 
> And make clean&&  make
If it's trunk then I would recommend to follow Phil's approach and get the 
newest version. The trunk heavily is under development and might be broken or 
unstable until it becomes a release version. If it's not the trunk, then please 
let us know so that we could have a closer look again ...

Best regards,
Andi


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