Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6808185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:55:27+00:00 2026-05-26T19:55:27+00:00

At some places, I have read that stacks grow from a higher address to

  • 0

At some places, I have read that stacks grow from a higher address to a lower address, but when I checked it out myself, I noticed that it grows from a lower to a higher address. For example, I allocated stack for a thread at address 2aba5ab06010 and at some point found out its value to be 2aba5b7050f0, which is clearly greater than the top of the stack.

But when I check the disassembly, I can see that function prologues subtract %rsp and epilogues add it, so in that sense, shouldn’t be the value of %rsp less than the top of the stack. Why these contradictory results?

Note that I am using Linux on an x86 64 bit machine and the gcc compiler.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:55:28+00:00Added an answer on May 26, 2026 at 7:55 pm

    The thread stack can grow upwards or downwards depending on the platform. A typically way to check this is let A call B function and with

    void FunctionB( int* FromFunctionA )
    {
       int localStackVariableB;
       //Compare &localStackVariableB and FromFunctionA addresses
    }
    
    
     void FunctionA( )
    {
       int localStackVariableA;
       FunctionB( &localStackVariableA) 
    }
    

    now compare the address of localStackVariableB and FromFunctionA and determine the direction. Make sure the optimization is turned off completely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read it here : CodeProject and some other places that there should
I'm in a thread. I have an address. Is that address from a variable
I am dealing with some HTML text that I basically have read access to.
I have read so many places is that if your code is not test-able
I've read in some places that JavaScript strings are UTF-16, and in other places
I've read in some places that there are problems with git (or just msysgit?)
CLOCK_MONOTONIC does not seem available, so clock_gettime is out. I've read in some places
I read up someplace, that there are characters other than A-Z that have a
I'm working on a class-based php web app. I have some places where objects
I have a Singleton to manage some variables I need in various places in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.