patacongo commented on issue #3737:
URL: 
https://github.com/apache/incubator-nuttx/issues/3737#issuecomment-846609034


   
   On 5/23/2021 12:56 PM, Gregory Nutt wrote:
   >
   >> It fails namely here (struct_main.c) on attempt to call the function:
   >> |97 mystruct->pf();|
   >>
   >> As you can see from the previous log
   >>
   >> |pf = 0xdcec (vs 0xdcec) PASS Calling mystruct->pf() arm_hardfault: 
   >> PANIC!!! Hard fault: 40000000 |
   >>
   >> the called address is even. However, in Thumb mode it must be odd.
   >> I tried to force it to be odd (by | 1) and the hard fault was fixed.
   >>
   >> If I understand correctly, the compiler should have initialized "pf" 
   >> field of "struct struct_s dummy" to an odd address automatically, 
   >> however it did not.
   >>
   > Yes, at some point bit 0 should have been set by the compiler before 
   > the call.  This used to work and I can't explain why it should be 
   > failing in this case.  It is really pretty generic C code.  The only 
   > purpose of this test is to assure that a structure is initialized 
   > properly.
   >
   > It does seem like a compiler issue.  Could it believe that dummyfunc() 
   > is an ARM (vs Thumb2) function?
   >
   > Sorry.  I'm no help on this one.
   >
   One I do in cases where I want to see what the compiler is doing is to 
   add -save-temps to the GCC command line.  I do this:
   
    1. Build with V=1 so that I can see the full compile command line,
    2. Add -save-temps to the command line, and
    3. Re-compile using the modified compiler command
   
   That will leave a .i and a .s file in addition to the .o file. The .s 
   has the generated assembly language.  I am not sure if it will tell you 
   anything new or now.  We already know that the value saved in the 
   structure did not have bit 0 set.
   
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to