https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87525
Bug ID: 87525 Summary: infinite loop generated for fread() if enabling -flto Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: taz.007 at zoho dot com Target Milestone: --- Created attachment 44792 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44792&action=edit screenshot of gdb with asm When trying to compile flac with -flto enabled, it seems to generate an infinite loop when the source code is calling fread(); If i remove the -flto flag, the generated code is no longer an infinite loop. You can find in attachment a screenshot of the gdb screen with the faulty code. Notice the loop at address 0xb7d16980 Also attached output of gcc -v -save-temps