Skip to content

Issue with the stack-switching strategy #3268

Closed as not planned
Closed as not planned

Description

@LemonBoy

A small excerpt from new_stack_call.zig compiled for AArch64, as you can see changing the value of the stack pointer doesn't stop LLVM from spilling stuff to/from it.

  2105fc:       90ffff89        adrp    x9, 200000 <os-0xbd0>                    
  210600:       91356129        add     x9, x9, #0xd58                           
  210604:       f940012a        ldr     x10, [x9]                                
  210608:       f9400529        ldr     x9, [x9, #8]                             
  21060c:       8b090149        add     x9, x10, x9                              
  210610:       92400d2a        and     x10, x9, #0xf                            
  210614:       eb0a0129        subs    x9, x9, x10                              
  210618:       910003e1        mov     x1, sp                                   
  21061c:       9100013f        mov     sp, x9 // The new SP is in place                     
  210620:       52809a48        mov     w8, #0x4d2 
  210624:       f90017e0        str     x0, [sp, #40] // Oh no!
  210628:       2a0803e0        mov     w0, w8                                   
  21062c:       f90013e1        str     x1, [sp, #32] // Oh no!
  210630:       b9001fe8        str     w8, [sp, #28] // Oh no!
  210634:       94000080        bl      210834 <targetFunction>     

Activity

  1. added this to the 0.6.0 milestone on Sep 20, 2019
  2. andrewrk commented on Sep 20, 2019

    @andrewrk
    Member

    Damn, looks like we'll have to rethink @newStackCall a bit. Thanks for the report.

  3. modified the milestones: 0.6.0, 0.7.0 on Oct 23, 2019
  4. added
    bug
    miscompilation
    on Dec 6, 2019
  5. modified the milestones: 0.7.0, 0.6.0 on Jan 30, 2020
  6. modified the milestones: 0.6.0, 0.7.0 on Feb 13, 2020
  7. added
    stage1
    on Feb 13, 2020
  8. modified the milestones: 0.7.0, 0.8.0 on Oct 17, 2020
  9. modified the milestones: 0.8.0, 0.9.0 on Nov 6, 2020
  10. modified the milestones: 0.9.0, 0.10.0 on May 19, 2021
  11. added
    backend-llvm
    and removed
    stage1
    on Dec 28, 2022
  12. modified the milestones: 0.14.0, 0.11.0 on Jul 22, 2023
  13. andrewrk commented on Jul 25, 2023

    @andrewrk
    Member

    @newStackCall was deleted from the language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-aarch64backend-llvmbugmiscompilation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions