Skip to content

Instantly share code, notes, and snippets.

@ljmccarthy
Created September 20, 2023 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljmccarthy/2851666d839e945acb17a55aebc79b32 to your computer and use it in GitHub Desktop.
Save ljmccarthy/2851666d839e945acb17a55aebc79b32 to your computer and use it in GitHub Desktop.
Run GCC with all optimisations disabled
#!/bin/sh
GCC_O0_OPTS_DISABLED=$(gcc -Q -O0 --help=optimizers | awk -v ORS=" " '($1 ~ /^-f/) && ($2 ~ /enabled/) {print "-fno-" substr($1,3)}')
exec gcc -O0 $GCC_O0_OPTS_DISABLED "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment