Re: [eigen] Eigen code gets optimized away by avr-g++ - what to do?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 29.06.2012 22:21, Ryan Pavlik wrote:
However, I am now seeing quite strange behavior. It looks like Eigen code
(and possibly the rest of the function in which it is used?) gets optimized
out of the compiled binary.  (It's so efficient, it doesn't have any code!
:D )  When built by the IDE, it uses -Os optimization (which is -O2 without
the ones deemed to potentially enlarge the code) which triggers the issue.
-O1 optimization doesn't seem to trigger it (by looking at the disassembly,
I actually see a call to sqrtf when my test program calls .norm() on a
vector) though I haven't actually run that code on a device.

The code looks simple enough that gcc can calculate the result of v1.norm() at compile-time. You should pass an unknown vector to the function, if you want see whether it actually does anything.

Christoph


--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/