hello Mr Matt godboltas the founder of www.godbolt.org can yu change that i mean it highlighting the keywords 'for' and 'while' when hovering assembly code so it might be helpful for every user cause how i know is it directly jumps to the condition right so highlighting the keyword in this case doesnt make sense for me N thank yu for replying me backjust change the functionality which highlights the keywords to highlight the condition so thats right yah N thank yu again for replying me back anyways do yu agree with what the compiler shows i mean highlighting the keywords 'while' and 'for' when hovering assembly code? i dont think yu are cause the whole world believes that after an iteration it jumps to the condition not the keywords 'while' and 'for';thank yukevinOn Mon, 2 Dec 2019 at 19:05, Matt Godbolt <ma...@godbolt.org> wrote:Hello Kevin,Thanks for you email, and for the comprehensive description of what you were seeing.Compiler Explorer uses the output of GCC and clang to highlight the relationship between the source input and the assembly output. The output from the compiler includes tags for each line of assembly telling me which lines of C or C++ those assembly lines are associated with. That's how I know to highlight.The GCC compiler in this case has decided to attribute some of the branch instructions with the `while` keyword. This is pretty weird I agree! If you change compiler (e.g. to clang) you'll see this changes - so it depends entirely on the compiler version and whatever that compiler's source attribution decides to do.To get more of a sense of what's happening: untick the ".text" filter in the ASM to show all the internal output that Compiler Explorer usually hides. On some of the surprising lines you'll see things like:.loc 1 9 1 is_stmt 1 # ./example.c:9:1
jge .LBB0_7The `.loc` here is saying "the next instruction is associated with line 9", which in this case is just the `for` keyword.There might be ways of us improving the output but in general Compiler Explorer uses the compiler's output and shows exactly what the compiler says is happening. For example, if you were to compile and debug the program you wrote you'd find the debugger making similar line choices.I hope that clears things up a bit. If you're interested in diving in more I'd be happy to give more information. It's always possible we can improve our output. In general though issues like these are usually compiler bugs - I've filed a few against GCC in my time for exactly these kinds of issues.Thanks again, MattOn Mon, Dec 2, 2019 at 2:13 AM kevin rushdi <kevinru...@gmail.com> wrote:hello Mr. Matt godboltafter writing 'for loop, while loop'; in C/C++ in Ur online compiler www.godbolt.org the assembly code is generated that's perfect up-to now but i got to know something from you when i separate the keywords 'while, for' from the condition like this:int main() {int i, y;i = 0;while(i < 10) {i++;}for(y = 0; y < 100; y++) {y++;}}and when i hover the jle, jmp, cmp statements of generated assembly code which is to the right side of the C/C++ code why it highlights the 'for and while keywords of the loop' without highlighting the conditions of the relevant 'while' and 'for' loops because there is no keywords in assembly code or machine code only a label is used to jump back into the condition so now my problem is why it highlights the keywords 'for and while' of C/C++ languages when i hover the assembly code jle, jmp, cmp statements of assembly language which is to the right side of the C/C++ code i wrote its supposed to highlight the condition of the 'while and for loop'. does it mean it jumps back to the keywords 'for and while' back without jumping to the condition according to what i learnt it jumps to the condition but the thing shown in here is completely different pls help me figure out what this is or pls do tell me whether this is a bug of the programexapmple of the C code :- https://godbolt.org/z/FwQzv3example of the C++ code :- https://godbolt.org/z/EQ3a-xpls open both the links and try hovering the assmbly code jmp, jle, cmp statements yu will see it highlights the keywords 'for and while' which is not possible it must highlight the condition but in here a different scenario is going pls check the above links and in C language the while keyword is not higlighted when hovering assembly code jle, jmp, cmp statements but the for loops 'for keyword' is highlighted. in C++ both the 'while and for keywords are highlighted when hovering assembly code jmp statments'thank youkevin--Matt
yes Mr. Matt godBoltso i must ask yu a question do yu agree of what it outputs i mean when hovering assembly code it highlights the keyword 'for' and 'while' so do yu think this is true as it is supposed to highlight the condition but instead it highlights the keyword 'while' and 'for' pls help me pls tell me ur ideas about this im really confused about this what is true if yu take a flowchart of a loop the execution jumps to the condition after every iteration but in here when i hover the assembly code jmp jle statements it highlights 'for' and 'while' keywords without highlighting the condition of the loop.does it mean it jumps to the keywords 'while' and 'for' after every iteration without jumping to the condition of a loopthank yukevin