Hosted by Dailymotion. For legal issues report at the Copyright Center, report us on DMC, or use the Instant Removal tool.
x86-64 Assembly Segfault on printf? Fix Stack Alignment (Yasm + GCC Demo)
7 Views • Nov 16, 2025
Description
We build a hybrid program using Yasm and GCC on Linux, print a message from C++, call an assembly function, and hit the crash. Then we fix it with a push and pop of RAX, move the fix into the function prologue and epilogue, and run experiments to prove it works.
No long lectures, just code, a real crash, and a real solution that stops the problem for good.
Introduction 00:00:00
Hybrid Programs 00:00:09
Stack Alignment Problem 00:00:33
GCC Stack Expectations 00:01:14
Makefile Overview 00:02:22
Driver Code 00:03:16
Assembly Module Setup 00:04:12
Calling printf 00:05:20
Program Crash Demo 00:07:17
Diagnosing Segfault 00:07:56
Fix with Push-Pop 00:09:08
Prologue Epilogue Fix 00:11:18
Experiments Confirm 00:12:54
Conclusion 00:13:32
Outro Thanks 00:13:52
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
Please help support us!
- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras
More from User
How to Perform AVL Tree Rotations - Step By Step Example
Neural Lantern
AVL Tree Rotations Tutorial: Fixing Imbalance After Adding a Node
Neural Lantern
AVL Tree Rotation Types Explained for Self-Balancing Binary Search Trees
Neural Lantern
AVL Tree Tutorial: Balance Factors and Why They Fix Slow BSTs
Neural Lantern
Binary Search Tree Removals - Delete Nodes with 0, 1, or 2 Children
Neural Lantern
How to Search in a Binary Search Tree (BST) - Step by Step Explanation with Examples
Neural Lantern
Related Videos
YASM x86-64 Assembly Functions Tutorial - Integers, Floats, Pointers, ABI, C++ Interoperability
Neural Lantern
x86-64 Assembly Pointers & Dereferencing Explained - Hybrid C++/YASM Example
Neural Lantern
x86-64 Assembly: Local Variables, Stack Frames & Alignment Explained
Neural Lantern
x86-64 Assembly: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)
Neural Lantern
x86-64 Assembly: Integer Data Movement, Pointers, and Dereferencing Explained (YASM on Ubuntu)
Neural Lantern
Mastering x86-64 YASM Assembly: Functions Made Simple
Neural Lantern