Undoc'd Feature?
|
07-31-2022, 02:12 AM
Post: #41
|
|||
|
|||
RE: Undoc'd Feature?
(07-17-2022 01:05 PM)Wes Loewer Wrote: ⋮ As an additional data point, I thought I’d try an Intel compiler (ICC 2021.5.0, optimizations on) on the following function: Code: int Wes2(int a) I got the following as output: Code: Wes2(int): I thought I’d also try the following, slightly different, function: Code: int Wes3(int &a) This slightly different function has the compiler producing the following, noticably distinct, output: Code: Wes3(int&): (Without optimization, for this last function, the compiler is producing code that increments three distinct temporaries by one and then assigning, as a final value for “a”, one of those three incremented-once temporaries, post increment.) When one goes rooting around with undefined behaviour, one can certainly feel the hidden contours of the magic machinery behind the scenes. That said, after seeing the above, I tried a few other similar functions and there does seem to be some issues with the Intel compiler’s handling of assignment operations post-C++17. (Even with a command-line option given to specify the version of C++ wanted.) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)