gcc bug? (was bug in gen5200/tod/pcf8563.c)

Joel Sherrill joel.sherrill at oarcorp.com
Tue May 15 11:25:30 UTC 2007


Wolram,

Can you produce a small cutdown of this which has a macro to switch
between the macro and inline versions and duplicates this?  I want to
try it on a more recent gcc and look at the preprocessed output.

If it is a side-effect of the macro, then looking at the preprocessed output
will show that. 

One possibility is that calling the inline results in type changes that 
do not
happen with the macro.

--joel

Wolfram Wadepohl wrote:
> Ingolf Steinbach schrieb:
>
>> I don't know PPC assembly either. But maybe the reason for your
>> problem becomes obvious if you compare the assembler code resulting
>> from the macro version with the assembler code resulting from the
>> inline function version of From_BCD(). Could you post both of them?
>
> Hello,
>
> here is the inline version (output from list windows in TRACE32):
> _addr/line__|code_____|label____|mnemonic________________|comment______________________________________________________| 
>
>             |
>             |    v1 = info[PCF8563_DAY_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_DAY_MASK;
>          175|    time->day = From_BCD(v1);
>  SF:000C7D88|5520E13E            srwi      r0,r9,0x4      ; r0,r9,CS0STR
>  SF:000C7D8C|1C00000A            mulli     r0,r0,0x0A     ; r0,r0,10
>  SF:000C7D90|5529073E            clrlwi    r9,r9,0x1C     ; r9,r9,GP_18
>  SF:000C7D94|7C004A14            add       r0,r0,r9
>  SF:000C7D98|901E0008            stw       r0,0x8(r30)    ; 
> r0,CS0STP(r30)
>  SF:000C7D9C|8921000A            lbz       r9,0x0A(r1)    ; r9,10(r1)
>  SF:000C7DA0|552906BE            clrlwi    r9,r9,0x1A     ; r9,r9,26
>             |
>             |    v1 = info[PCF8563_HOUR_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_HOUR_MASK;
>          178|    time->hour = From_BCD(v1);
>  SF:000C7DA4|5520E13E            srwi      r0,r9,0x4      ; r0,r9,CS0STR
>  SF:000C7DA8|1C00000A            mulli     r0,r0,0x0A     ; r0,r0,10
>  SF:000C7DAC|5529073E            clrlwi    r9,r9,0x1C     ; r9,r9,GP_18
>  SF:000C7DB0|7C004A14            add       r0,r0,r9
>  SF:000C7DB4|901E000C            stw       r0,0x0C(r30)   ; 
> r0,CS1STR(r30)
>  SF:000C7DB8|89210009            lbz       r9,0x9(r1)     ; r9,9(r1)
>  SF:000C7DBC|5529067E            clrlwi    r9,r9,0x19     ; r9,r9,25
>             |
>             |    v1 = info[PCF8563_MINUTE_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_MINUTE_MASK;
>          181|    time->minute = From_BCD(v1);
>  SF:000C7DC0|5520E13E            srwi      r0,r9,0x4      ; r0,r9,CS0STR
>  SF:000C7DC4|1C00000A            mulli     r0,r0,0x0A     ; r0,r0,10
>  SF:000C7DC8|5529073E            clrlwi    r9,r9,0x1C     ; r9,r9,GP_18
>  SF:000C7DCC|7C004A14            add       r0,r0,r9
>  SF:000C7DD0|901E0010            stw       r0,0x10(r30)   ; 
> r0,CS1STP(r30)
>  SF:000C7DD4|89210008            lbz       r9,0x8(r1)     ; r9,info(r1)
>
> and here the macro version:
> _addr/line__|code_____|label____|mnemonic________________|comment______________________________________________________| 
>
>             |
>          165|    v1 = info[PCF8563_DAY_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_DAY_MASK;
>  SF:000C6840|8961000B            lbz       r11,0x0B(r1)   ; r11,11(r1)
>          166|    time->day = From_BCD(v1);
>  SF:000C6844|5569E7BE            extrwi    r9,r11,0x2,0x1A; 
> r9,r11,CTRL_PRECHARGE,26
>  SF:000C6848|1D29000A            mulli     r9,r9,0x0A     ; r9,r9,10
>  SF:000C684C|556B073E            clrlwi    r11,r11,0x1C   ; r11,r11,GP_18
>  SF:000C6850|7D295A14            add       r9,r9,r11
>  SF:000C6854|913E0008            stw       r9,0x8(r30)    ; 
> r9,CS0STP(r30)
>             |
>          168|    v1 = info[PCF8563_HOUR_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_HOUR_MASK;
>  SF:000C6858|8801000A            lbz       r0,0x0A(r1)    ; r0,10(r1)
>          169|    time->hour = From_BCD(v1);
> _SF:000C685C|5400077A            rlwinm    
> r0,r0,0x0,0x1D,0x1D;_r0,r0,0,29,29
>  SF:000C6860|901E000C            stw       r0,0x0C(r30)   ; 
> r0,CS1STR(r30)
>             |
>          171|    v1 = info[PCF8563_MINUTE_ADR-PCF8563_SECOND_ADR] & 
> PCF8563_MINUTE_MASK;
>  SF:000C6864|89210009            lbz       r9,0x9(r1)     ; r9,9(r1)
>          172|    time->minute = From_BCD(v1);
>  SF:000C6868|5520E77E            extrwi    r0,r9,0x3,0x19 ; r0,r9,3,25
>  SF:000C686C|1C00000A            mulli     r0,r0,0x0A     ; r0,r0,10
>  SF:000C6870|5529073E            clrlwi    r9,r9,0x1C     ; r9,r9,GP_18
>  SF:000C6874|7C004A14            add       r0,r0,r9
>  SF:000C6878|901E0010            stw       r0,0x10(r30)   ; 
> r0,CS1STP(r30)
>
> it is obvious that the code generated for line 169 of the macro 
> version does not do the same computation as the code of the inlined 
> version (line 178). differnces in line numbering because of the 
> function definitions for inline functions in source file.
>
> my question: is this a misbehaviour of the gcc? i'm using cygwin tools
> powerpc-rtems4.7-gcc (GCC) 4.0.1
> (RTEMS gcc-4.0.1-20050810/newlib-1.13.0-20050810-4)
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   




More information about the users mailing list