https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90930
Bug ID: 90930 Summary: Excessive memory consumption Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: clyon at gcc dot gnu.org Target Milestone: --- Hi, aarch64-linux-gnu-gcc consumes a lot of memory and takes a lot of time to compile the attached code, or it fails with "cc1: out of memory allocating.." depending on the host machine. aarch64-linux-gnu-gcc -c -O2 -Wno-unused-parameter -Wall -W open62541.c On the (x86_64) machine I used, it took 15 minutes and 12GB of memory, which compiling with arm-linux-gnueabihf-gcc took about 6 minutes and 1GB of memory, which is more reasonable. Using -O0 avoids the problem. The file also compiles well if –O2 is removed and all optimization flags described in https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Optimize-Options.html#Optimize-Options for O1 and O2 are added (-ffinite-loops is replaced by fsplit-loops; fdelayed-branch is removed due to missing support on target) Command: aarch64-linux-gnu-gcc -c -fsplit-loops -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdse -fforward-propagate -fguess-branch-probability -fif-conversion2 -fif-conversion -finline-functions-called-once -fipa-pure-const -fipa-profile -fipa-reference -fmerge-constants -fmove-loop-invariants -freorder-blocks -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-sink -ftree-slsr -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time -falign-functions -falign-jumps -falign-labels -falign-loops -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fexpensive-optimizations -fgcse -fgcse-lm -fhoist-adjacent-loads -finline-small-functions -findirect-inlining -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp -fisolate-erroneous-paths-dereference -flra-remat -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -freorder-blocks-algorithm=stc -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing -fthread-jumps -ftree-builtin-call-dce -ftree-pre -ftree-switch-conversion -ftree-tail-merge -ftree-vrp -Wno-unused-parameter -Wall -W open62541.c The problem was also noticed with gcc-7 and gcc-8.