Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
ada source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
S390X GNAT 11.2.0
S390X GNAT 12.1.0
S390X GNAT 12.2.0
S390X GNAT 12.3.0
S390X GNAT 12.4.0
S390X GNAT 13.1.0
S390X GNAT 13.2.0
S390X GNAT 13.3.0
S390X GNAT 14.1.0
S390X GNAT 14.2.0
arm gnat 10.3.0-2 (Alire)
arm gnat 11.2.0-3 (Alire)
arm gnat 13.1.0
arm gnat 13.2.0
arm gnat 13.3.0
arm gnat 14.1.0
arm gnat 14.2.0
arm64 gnat 12.1.0
arm64 gnat 12.2.0
arm64 gnat 12.3.0
arm64 gnat 12.4.0
arm64 gnat 13.1.0
arm64 gnat 13.2.0
arm64 gnat 13.3.0
arm64 gnat 14.1.0
arm64 gnat 14.2.0
hppa gnat 14.2.0
loongarch64 gnat 14.1.0
loongarch64 gnat 14.2.0
mips gnat 11.2.0
mips gnat 12.1.0
mips gnat 12.2.0
mips gnat 12.3.0
mips gnat 12.4.0
mips gnat 13.1.0
mips gnat 13.2.0
mips gnat 13.3.0
mips gnat 14.1.0
mips gnat 14.2.0
mips64 gnat 11.2.0
mips64 gnat 12.1.0
mips64 gnat 12.2.0
mips64 gnat 12.3.0
mips64 gnat 12.4.0
mips64 gnat 13.1.0
mips64 gnat 13.2.0
mips64 gnat 13.3.0
mips64 gnat 14.1.0
mips64 gnat 14.2.0
powerpc gnat 11.2.0
powerpc gnat 12.1.0
powerpc gnat 12.2.0
powerpc gnat 12.3.0
powerpc gnat 12.4.0
powerpc gnat 13.1.0
powerpc gnat 13.2.0
powerpc gnat 13.3.0
powerpc gnat 14.1.0
powerpc gnat 14.2.0
powerpc64 gnat 12.1.0
powerpc64 gnat 12.2.0
powerpc64 gnat 12.3.0
powerpc64 gnat 12.4.0
powerpc64 gnat 13.1.0
powerpc64 gnat 13.2.0
powerpc64 gnat 13.3.0
powerpc64 gnat 14.1.0
powerpc64 gnat 14.2.0
powerpc64 gnat trunk
powerpc64le gnat 11.2.0
powerpc64le gnat 12.1.0
powerpc64le gnat 12.2.0
powerpc64le gnat 12.3.0
powerpc64le gnat 12.4.0
powerpc64le gnat 13.1.0
powerpc64le gnat 13.2.0
powerpc64le gnat 13.3.0
powerpc64le gnat 14.1.0
powerpc64le gnat 14.2.0
powerpc64le gnat trunk
riscv64 gnat 10.3.0-2 (Alire)
riscv64 gnat 11.2.0-3 (Alire)
riscv64 gnat 12.3.0
riscv64 gnat 12.4.0
riscv64 gnat 13.1.0
riscv64 gnat 13.2.0
riscv64 gnat 13.3.0
riscv64 gnat 14.1.0
riscv64 gnat 14.2.0
sparc gnat 12.2.0
sparc gnat 12.3.0
sparc gnat 12.4.0
sparc gnat 13.1.0
sparc gnat 13.2.0
sparc gnat 13.3.0
sparc gnat 14.1.0
sparc gnat 14.2.0
sparc leon gnat 13.1.0
sparc leon gnat 13.2.0
sparc leon gnat 13.3.0
sparc leon gnat 14.1.0
sparc leon gnat 14.2.0
sparc64 gnat 12.2.0
sparc64 gnat 12.3.0
sparc64 gnat 12.4.0
sparc64 gnat 13.1.0
sparc64 gnat 13.2.0
sparc64 gnat 13.3.0
sparc64 gnat 14.1.0
sparc64 gnat 14.2.0
x86-64 gnat (trunk)
x86-64 gnat 10.2
x86-64 gnat 10.4
x86-64 gnat 10.5
x86-64 gnat 11.1
x86-64 gnat 11.2
x86-64 gnat 11.3
x86-64 gnat 11.4
x86-64 gnat 12.1
x86-64 gnat 12.2
x86-64 gnat 12.3
x86-64 gnat 12.4
x86-64 gnat 13.1
x86-64 gnat 13.2
x86-64 gnat 13.3
x86-64 gnat 14.1
x86-64 gnat 14.2
x86-64 gnat 8.2
x86-64 gnat 9.5
Options
Source code
-- This pragma will remove the warning produced by the default -- CE filename and the procedure name differing, -- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName pragma Source_File_Name (Square, Body_File_Name => "example.adb"); -- Type your code here, or load an example. function Square(num : Integer) return Integer is begin return num**2; end Square; -- Ada 2012 also provides Expression Functions -- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html) -- as a short hand for functions whose body consists of a -- single return statement. However they cannot be used as a -- compilation unit. -- function Square(num : Integer) return Integer is (num**2);
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree