edit: interestingly enough seems to work on some architectures and not others, a friend of mine tried it and it worked for him. I guess that's why it's an undefined behvaior. :)
I assumed, at first, that it was somehow falling through the infinite loop and accidentally runnning the unreachable function, but it clearly explicitly runs it in the assembler generated...
c++ 10f4: 48 8d 3d d5 00 00 00 lea 0xd5(%rip),%rdi # 11d0 <_Z11unreachablev> 10fb: ff 15 b7 2e 00 00 call *0x2eb7(%rip) # 3fb8 <__libc_start_main@GLIBC_2.34>
how odd.
edit: ah, it's called from __start, which suggests that main is being elided entirely by the optimiser, and somehow 'unreachable' is simply becoming a defacto 'main'
Anders Rytter Hansen
in reply to ☆ Yσɠƚԋσʂ ☆ • •Dessalines likes this.
☆ Yσɠƚԋσʂ ☆
in reply to Anders Rytter Hansen • • •Dessalines likes this.
taylus doesn't like this.
Programmer Humor reshared this.
dragnucs
in reply to ☆ Yσɠƚԋσʂ ☆ • • •Could not reproduce.
Dessalines likes this.
☆ Yσɠƚԋσʂ ☆
in reply to dragnucs • • •edit: interestingly enough seems to work on some architectures and not others, a friend of mine tried it and it worked for him. I guess that's why it's an undefined behvaior. :)
like this
dragnucs and possum like this.
Prologue7642
in reply to dragnucs • • •clang++ loop.cpp -O1 -Wall -o loop
this page likely doesn't use clang but GCC, so it won't work.like this
Dessalines, dragnucs and possum like this.
☆ Yσɠƚԋσʂ ☆
Unknown parent • • •Dessalines likes this.
taylus doesn't like this.
TheElectroness
in reply to ☆ Yσɠƚԋσʂ ☆ • • •I assumed, at first, that it was somehow falling through the infinite loop and accidentally runnning the unreachable function, but it clearly explicitly runs it in the assembler generated...
c++ 10f4: 48 8d 3d d5 00 00 00 lea 0xd5(%rip),%rdi # 11d0 <_Z11unreachablev> 10fb: ff 15 b7 2e 00 00 call *0x2eb7(%rip) # 3fb8 <__libc_start_main@GLIBC_2.34>
how odd.
edit: ah, it's called from __start, which suggests that main is being elided entirely by the optimiser, and somehow 'unreachable' is simply becoming a defacto 'main'
like this
☆ Yσɠƚԋσʂ ☆, gubxuhki, MartianSands and GitProphet like this.