待辦事項 #41753

-O2 Bug Infinite Loop

啟用日期: 2021-03-13 04:07 最後更新: 2021-03-13 07:32

回報者:
負責人:
(無)
類型:
狀態:
關閉
元件:
里程碑:
(無)
優先權:
1 - 最低
嚴重程度:
1 - 最低
處理結果:
Rejected
檔案:
Vote
Score: 0
50.0% (1/2)
50.0% (1/2)

細節

This Piece of Code is getting Stuck In Infinite Loop when Using -O2 Flag

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4. ll f() {
  5. for (int i = 0; i < 3; i++) {
  6. for (int j = 0; j < 2; j++) {
  7. cout << i << " " << j << endl;
  8. }
  9. }
  10. }
  11. int main() {
  12. f();
  13. return 0;
  14. }

Ticket History (2/2 Histories)

2021-03-13 04:07 Updated by: first_last
  • New Ticket "-O2 Bug Infinite Loop" created
2021-03-13 07:32 Updated by: keith
評語

Several comments:

  1. 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.
  2. 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.
  3. 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>.
  4. 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.

Attachment File List

No attachments

編輯

Please login to add comment to this ticket » 登入