#41753: -O2 Bug Infinite Loop Open Date: 2021-03-12 19:07 Last Update: 2021-03-12 22:32 URL for this Ticket: https://osdn.net//projects/mingw/ticket/41753 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=41753 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2021-03-12 22:32 Updated by: keith * Status Update from Open to Closed * Resolution Update from None to Rejected * Milestone Update from Create a 64bit build environment for the MinGW.org project. to (None) * Severity Update from 9 - Highest to 1 - Lowest * Priority Update from 9 - Highest to 1 - Lowest * Details Updated Comment: Several comments: What part of the instruction: "priority is to be assigned only by an approved MinGW developer" do you not understand? You are not such a developer. Thus your attempt to escalate priority guarantees that this ticket will be treated as lowest priority. This is not specifically a MinGW bug. Yes, I can see that it misbehaves as you suggest, but it exhibits similar misbehaviour when I compile it as a native GNU/Linux application, (using GCC-10.2 on Manjaro Linux). If you want it pursued, you need to raise the issue on the GCC bug tracker. You really should not use #include <bits/stdc++.h> directly in user code; that's an internal-use header. In this example, you should be using #include <iostream>. If I compile your code, I see a warning about a missing return statement, in your non-void f() function. Address that warning, either by adding the missing return statement, or by declaring void f(), and the misbehaviour does not occur. Given the above, I am not going to pursue this. --------------------------------------------------------------------- Ticket Status: Reporter: first_last Owner: (None) Type: Issues Status: Closed Priority: 1 - Lowest MileStone: (None) Component: GCC Severity: 1 - Lowest Resolution: Rejected --------------------------------------------------------------------- Ticket details: This Piece of Code is getting Stuck In Infinite Loop when Using -O2 Flag #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll f() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { cout << i << " " << j << endl; } } } int main() { f(); return 0; } -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/mingw/ticket/41753 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=41753