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

  • Home
  • SEARCH
  • 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 546321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:51:17+00:00 2026-05-13T10:51:17+00:00

I use inline assembly massively in a project where I need to call functions

  • 0

I use inline assembly massively in a project where I need to call functions with an unknown number of arguments at compile time and while I manage myself to get it to work, sometimes, in linux (in windows I don’t recall having that problem) strange things like this happen:

If I have something like

for(int i = 1; i >= 0; i--)
   asm("push %0"::"m"(someArray[i]));

It works.

If I have

for(int i = this->someVar; i >= 0; i--)
   asm("push %0"::"m"(someArray[i]));

and I guarantee with my life that someVar is holding the value 1 it throws segmentation fault.

Also if I have

int x = 1;
for(int i = x; i >= 0; i--)
   asm("push %0"::"m"(someArray[i]));

it works but

int x = this->someVar;
for(int i = x; i >= 0; i--)
    asm("push %0"::"m"(someArray[i]));

does not.

Also, and also strangely, I can say that while in some functions I don’t have problems doing that in others I have, all in the same object.

If someone can point me to some information that can clear up what’s the problem there, I would appreciate.

Beware that I really have to push the arguments in a for loop so avoiding it is not an option.

I also tried using the inline assembly word “volatile” but nothing changed.

  • 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-13T10:51:18+00:00Added an answer on May 13, 2026 at 10:51 am

    I can’t understand what’s the problem but try to write code using clear asm code same as

    asm{
       loop1:
         mov ax, this->var
         ...
         dec ax
         cmp ax, 0
         je exit
         jmp loop1
    }
    

    …

    exit:

    Also try to make “var” value as static may it help too.

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

Sidebar

Related Questions

In my project I need to use inline Assembly, but it need to be
While it would be very convenient to use inline functions at some situations, Are
I am trying to use a thread local variable in inline assembly, but when
If you want to call a C/C++ function from inline assembly, you can do
I am not very good in inline assembly, but planning to use it for
Can I somehow use inline assembly in Haskell (similar to what GCC does for
I want to use GCC inline assembly, Intel syntax. Is there an equivalent for
Is there any restriction on using #define'd functions/inline functions inside Assembly files. I referred
I'm using inline assembly to construct a set of passwords, which I will use
While going through some C code having inline assembly I came across the .byte

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.