在 2024-04-10 17:49, stefan@xxxxxxxxx 写道:
But I keep considering this as a bug. And clang behaves correctly!
Yes there have been many reports [1]. It's a missed optimization.You may work around it by using 32-bit parameters, or casting either operand to u32; casting the result will not help.
[1] https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=SUSPENDED&bug_status=WAITING&bug_status=REOPENED&cf_gcctarget=x86_64&cf_gcctarget_type=allwordssubstr&cf_known_to_fail_type=allwords&cf_known_to_work_type=allwords&f0=OP&f1=OP&f2=product&f3=component&f4=alias&f5=short_desc&f7=content&f8=CP&f9=CP&j1=OR&list_id=423756&o2=substring&o3=substring&o4=substring&o5=substring&o6=substring&o7=matches&query_format=advanced&short_desc=sign%20extension&short_desc_type=allwordssubstr&v2=sign-extension&v3=sign-extension&v4=sign-extension&v5=sign-extension&v6=sign-extension&v7="sign-extension"
-- Best regards, LIU Hao
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature