bugAVR C Runtime Library - Bugs: bug #22415, malloc and realloc not using SPH...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22415: malloc and realloc not using SPH in winavr20071221

Submitter:  CurtVM <curtvm>
Submitted:  Mon 25 Feb 2008 05:26:27 PM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  libc code
Status:  Fixed Assigned to:  joerg_wunsch
Percent Complete:  0% Open/Closed:  Closed
Release:  None Fixed Release:  None

Mon 25 Feb 2008 08:10:34 PM UTC, comment #2: 

Yes, the subject sounded familar to me.

I just verified a fresh build of avr-libc-1.6:

  fa:   01 f4           brne    .+0             ; 0xfc <malloc+0xfc>
                        fa: R_AVR_7_PCREL       .text+0x10c
  fc:   2d b7           in      r18, 0x3d       ; 61
  fe:   3e b7           in      r19, 0x3e       ; 62
 100:   80 91 00 00     lds     r24, 0x0000
                        102: R_AVR_16   .data
 104:   90 91 00 00     lds     r25, 0x0000
                        106: R_AVR_16   .data+0x1
 108:   28 1b           sub     r18, r24
 10a:   39 0b           sbc     r19, r25
 10c:   a0 91 00 00     lds     r26, 0x0000
                        10e: R_AVR_16   __brkval
 110:   b0 91 00 00     lds     r27, 0x0000
                        112: R_AVR_16   __brkval+0x1

So everything looks fine now.

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 25 Feb 2008 06:50:53 PM UTC, comment #1: 

Joerg may have already fixed this bug with this diff:
<http://cvs.savannah.nongnu.org/viewvc/avr-libc/include/avr/common.h?root=avr-libc&r1=1.3.2.2&r2=1.3.2.3>

Joerg fixed the conditional compilation on the definition of SP in common.h, which was for a problem in setjmp. This may also fix the problem in malloc/realloc, but it needs to be tested with the latest cvs on the 1.6 branch.

Eric Weddington <arcanum>
Group administrator
Mon 25 Feb 2008 05:26:27 PM UTC, original submission:  

WinAVR20071221-
malloc.o and realloc.o in every libc.a is missing the use of SPH when getting the stack pointer.

This line from malloc.c, which should be getting the SP-
cp = STACK_POINTER() - __malloc_margin;

ends up only getting SPL-
 114: 8d b7       in r24, 0x3d ; 61
 116: 28 2f       mov r18, r24
 118: 30 e0       ldi r19, 0x00 ; 0

SPH is not being used.

avr freaks thread-
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=60233&start=20&postdays=0&postorder=asc&highlight=


CurtVM <curtvm>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by curtvm (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-02-25 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code