Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Probably a bug in C++

Revision en1, by Igor_Parfenov, 2022-09-11 12:47:22
Code1

Look at this code. It seems, the expected output is always 1. However, in

  • Codeforces
    • G++20
    • G++17
    • G++14
    • VC++2017
  • in my local Windows G++ 8.1.0
  • in my local Debian 10.2.1

the output is always 0. In Codeforces::Clang++17 & Clang++20 the output is

Clang++
Code2

Now look at this code. Here in all previously mensioned compilers (including Clang++) the output is always 1.

How found
Tags c++, gnu c++, ms visual c++, clang, undefined behavior, compilers

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Igor_Parfenov 2022-09-11 13:36:21 7
en1 English Igor_Parfenov 2022-09-11 12:47:22 2362 Initial revision (published)