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 8171561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:29:59+00:00 2026-06-06T21:29:59+00:00

Why the following code illegal in gas? # cat -n gas.asm 1 2 .code64

  • 0

Why the following code illegal in gas?

# cat -n gas.asm
1
2  .code64
3  pushb $12
4
# as gas.asm
gas.asm: Assembler messages:
gas.asm:3: Error: suffix or operands invalid for `push'

Isn’t it matchs:

| Opcode* | Instruction | Op/En | 64-Bit Mode | Compat/Leg Mode | Description |
|      6A | PUSH imm8   | C     | Valid       | Valid           | Push imm8.  |

But, the following code works in NASM.

bits 64
push byte 12

Why gas get that error on X86-64 platform?

Thanks!

  • 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-06-06T21:30:00+00:00Added an answer on June 6, 2026 at 9:30 pm

    See this thread.

    Quote:

    I think what you are refering to is ‘0x6A PUSH imm8’. This does not push a
    byte onto the stack
    . It pushes a byte value, encoded as part of the
    instruction, as either a word (16-bits) or the CPU size [longword (32-bits)
    for 32-bit CPUs and quadword (64-bits) for 64-bit CPUs] depending on the
    stack size for the current CPU mode and size override prefixes.

    In short, this is in effect a pushw. gas make this fact explicit and force you to use pushw $12.

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

Sidebar

Related Questions

The following code outputs Illegal seek: #include <stdio.h> #include <errno.h> #include <string.h> int main()
How can I easily do the following in GWT? (The code below is illegal
Possible Duplicate: Switch statement fallthrough in C#? The following code is illegal in C#
Why does the following code generate a compile error? Edit: My original code wasn't
The following code is illegal: public struct MyStruct { public MyStruct(int a, int b)
When I execute the following code in Chrome 18 beta I get the error:
I am getting the following error: Uncaught SyntaxError: Unexpected token ILLEGAL and this is
I get a error when trying out the following code in Chrome: var db
I'm not sure why the last statement in the following code is illegal. Integer
The following code does not compile ... any idea why? Is this illegal C++?

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.