This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos 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]

[Bug 1001520] Fix compiler warnings in Cortex-M architecture HAL


Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001520

--- Comment #2 from Ilija Kocho <ilijak@siva.com.mk> 2012-03-12 09:17:51 GMT ---
(In reply to comment #1)
> I would like to be very sure that GCC 4.6 is not going to try and optimise away
> the read. Can you provide a disassembly of something containing that macro,
> compiled with -O2 ? I don't have a suitable GCC 4.6 available to me here.
> 
> Thanks,
> 
> Jifl

Here it is both patched and non-patched, from the spot that raises warning:
kernel/current/src/common/clock.cxx:884:5

// Patched for GCC 4.6 -------------------------------------------------------

cyg_uint32 Cyg_RealTimeClock::isr(cyg_vector vector, CYG_ADDRWORD data)
{
1fff7f40:    b508          push    {r3, lr}
    }
#endif

    CYG_INSTRUMENT_CLOCK( ISR, 0, 0);

    HAL_CLOCK_RESET( CYGNUM_HAL_INTERRUPT_RTC,
CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
1fff7f42:    f24e 0310     movw    r3, #57360    ; 0xe010
1fff7f46:    f2ce 0300     movt    r3, #57344    ; 0xe000

    Cyg_Interrupt::acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_RTC);
1fff7f4a:    2000          movs    r0, #0
    }
#endif

    CYG_INSTRUMENT_CLOCK( ISR, 0, 0);

    HAL_CLOCK_RESET( CYGNUM_HAL_INTERRUPT_RTC,
CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
1fff7f4c:    681b          ldr    r3, [r3, #0]


// No patch -----------------------------------------------------------------

cyg_uint32 Cyg_RealTimeClock::isr(cyg_vector vector, CYG_ADDRWORD data)
{
1fff7f40:    b508          push    {r3, lr}
    }
#endif

    CYG_INSTRUMENT_CLOCK( ISR, 0, 0);

    HAL_CLOCK_RESET( CYGNUM_HAL_INTERRUPT_RTC,
CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
1fff7f42:    f24e 0310     movw    r3, #57360    ; 0xe010
1fff7f46:    f2ce 0300     movt    r3, #57344    ; 0xe000

    Cyg_Interrupt::acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_RTC);
1fff7f4a:    2000          movs    r0, #0
    }
#endif

    CYG_INSTRUMENT_CLOCK( ISR, 0, 0);

    HAL_CLOCK_RESET( CYGNUM_HAL_INTERRUPT_RTC,
CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
1fff7f4c:    681b          ldr    r3, [r3, #0]

-----------------------------------------------------------------------------

Apparently, the patched and non-patched versions produce identical code.
At the beginning, I was little-bit confused too as "unused" sounds like we are
telling the compiler that variable us "unused" while it really means "in know
that it looks 'unused' to you but I know what I'm doing". To my understanding
(only GCC fellows can give authentic clarification) this attribute doesn't
affect compiler optimization only suppresses the warning.
What I really wander (am curious) is: what hinders the compiler from seeing
that the variable within (this) macro is (actually) being used.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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