Date: Fri, 27 Aug 2021 10:12:09 +0000 From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 258079] clang-11 fails: candidate template ignored: substitution failure [with U = float]: variable length array cannot be formed during template argument deduction Message-ID: <bug-258079-29464-KVPTsfItxZ@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-258079-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-258079-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258079 David Chisnall <theraven@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |Works As Intended Status|New |Closed CC| |theraven@FreeBSD.org --- Comment #4 from David Chisnall <theraven@FreeBSD.org> --- The code in the test case contains undefined behaviour. `IntBits` is 64 - = 20, whcih is 44. `1U` is an `unsigned int`, which is 32 bits. `1U<<44` is a s= hift of greater than the width od the type, which is undefined behaviour. This is *probably* benign here, because array sizes in arguments in C/C++ a= re ignored and so this probably won't propagate into the generated IR (though = if it does, both clang and GCC will take advantage of the UB and probably redu= ce this to something that traps. The correct fix is to change `1U` to `1ULL`. Rejecting code that contains undefined behaviour is both allowed by the standard and generally considered more user-friendly behaviour than accepting it and generating broken code. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-258079-29464-KVPTsfItxZ>