[LLVMdev] Is infinite empty loop dead code?

Shuxin Yang shuxin.llvm at gmail.com
Wed Nov 14 09:38:23 PST 2012


Hi, dear Wenren:

    Thank you so much for sharing this info. I really appreciate it.
Now I can move on deleting dead non-countable loops.
Thank you again!

Shuxin


On 11/14/12 12:56 AM, 陳韋任 (Wei-Ren Chen) wrote:
> On Wed, Nov 14, 2012 at 12:22:33AM -0800, Shuxin Yang wrote:
>> I do some google, I cannot find the answer...
>> I check C std, I cannot find answer either.
>>
>> Delete infinite empty loop is boring, but if C/C++ lawyers could tell it
>> is safe to to so,
>> it would obviate the need to prove a non-countable loop infinite or not
>> before
>> DCE can delete it.
>>
>> That is the answer I'm waiting for to delete a disgusting dead
>> non-countable loop in my way.
>    Perhaps Duncan will give you a proper keyword to search in GCC/LLVM
> ML archieve. I found a page [1], and iiuc, the C standard allow the
> implementation (i.e., the compiler) to remove such empty infinite loop.
>
> Regards,
> chenwj
>
> [1]
> https://www.securecoding.cert.org/confluence/display/seccode/MSC40-C.+Do+not+use+an+empty+infinite+loop
>




More information about the llvm-dev mailing list