[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-02-04 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 Thomas Koenig changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-27 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #26 from Thomas Koenig --- There is a bit more that can be done when the exponent is known at compile time. For example, unsigned(kind=4) :: x y = x**13u could be translated as if (x & 7 == 0) /* Check for divisibili

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-26 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #25 from Thomas Koenig --- Created attachment 60283 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60283&action=edit Preliminary patch Here's a mostly-complete patch. It lacks test cases and and ChangeLog entries, but should w

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-25 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #24 from Thomas Koenig --- Considering that ctz is rather expensive, comparable to an integer multiplication, I think I will do away with this optimization altogether - we are spending log2(n) imuls anyway. I think the library versi

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-24 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #23 from Mikael Morin --- (In reply to Thomas Koenig from comment #20) > Right now, I am doing unsigned**unsigned. This is already a > bit larger than I originally thought. After this is committed, > we can still discuss how to ext

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-23 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #22 from anlauf at gcc dot gnu.org --- (In reply to anlauf from comment #21) > When doing x ** n in unsigned binary arithmetic, and x is an unsigned with k > bits, and we do arithmetic modulo 2^k, then > > x ** n = x ** min (n, k)

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-23 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #21 from anlauf at gcc dot gnu.org --- When doing x ** n in unsigned binary arithmetic, and x is an unsigned with k bits, and we do arithmetic modulo 2^k, then x ** n = x ** min (n, k) (mod 2^k) so we can immediately saturate the

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-23 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #20 from Thomas Koenig --- Right now, I am doing unsigned**unsigned. This is already a bit larger than I originally thought. After this is committed, we can still discuss how to extend it, I think. There is actually an interesting

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-17 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 Mikael Morin changed: What|Removed |Added CC||mikael at gcc dot gnu.org --- Comment #1

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-17 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #18 from kargls at comcast dot net --- On 1/17/25 10:17, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 > > --- Comment #17 from anlauf at gcc dot gnu.org --- > > As it is not clear what is th

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-17 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #17 from anlauf at gcc dot gnu.org --- A type promotion or conversion for binary operations is a real issue. While it is feasible, we should step back and draw a line what is more or less consistent with the spirit of the UNSIGNED pro

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-17 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #16 from kargls at comcast dot net --- On 1/17/25 03:47, tkoenig at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 > > --- Comment #15 from Thomas Koenig --- > (In reply to kargls from comment #14) >> (

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-17 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #15 from Thomas Koenig --- (In reply to kargls from comment #14) > (In reply to anlauf from comment #13) > > (In reply to kargls from comment #12) > > > (In reply to Thomas Koenig from comment #9) > > > > Question is, what should we

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #14 from kargls at comcast dot net --- (In reply to anlauf from comment #13) > (In reply to kargls from comment #12) > > (In reply to Thomas Koenig from comment #9) > > > Question is, what should we permit... > > > > > > For 'normal'

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #13 from anlauf at gcc dot gnu.org --- (In reply to kargls from comment #12) > (In reply to Thomas Koenig from comment #9) > > Question is, what should we permit... > > > > For 'normal' operations, only unsigned op unsigned is permit

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #12 from kargls at comcast dot net --- (In reply to Thomas Koenig from comment #9) > Question is, what should we permit... > > For 'normal' operations, only unsigned op unsigned is permitted, > so unsigned**unsigned is obviously ok.

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #11 from anlauf at gcc dot gnu.org --- (In reply to Jerry DeLisle from comment #10) > (In reply to Thomas Koenig from comment #9) > > Question is, what should we permit... > > > > For 'normal' operations, only unsigned op unsigned is

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #10 from Jerry DeLisle --- (In reply to Thomas Koenig from comment #9) > Question is, what should we permit... > > For 'normal' operations, only unsigned op unsigned is permitted, > so unsigned**unsigned is obviously ok. > > What a

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #9 from Thomas Koenig --- Question is, what should we permit... For 'normal' operations, only unsigned op unsigned is permitted, so unsigned**unsigned is obviously ok. What about (integer|real|complex)**unsigned? What about unsign

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-16 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 Thomas Koenig changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed|

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 Jerry DeLisle changed: What|Removed |Added CC||jvdelisle at gcc dot gnu.org --- Commen

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #6 from kargls at comcast dot net --- (In reply to kargls from comment #5) > (In reply to Thomas Koenig from comment #3) > Yes, please lift the restriction. I ran into this issue while > writing a testcase as well. As J3 is not con

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #5 from kargls at comcast dot net --- (In reply to Thomas Koenig from comment #3) > (In reply to kargls from comment #2) > > Not Thomas, but ... > > > > https://j3-fortran.org/doc/year/24/24-116.txt > > > > The exponentiation operat

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to Thomas Koenig from comment #3) > (In reply to kargls from comment #2) > > Not Thomas, but ... > > > > https://j3-fortran.org/doc/year/24/24-116.txt > > > > The exponentiation operat

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 --- Comment #3 from Thomas Koenig --- (In reply to kargls from comment #2) > Not Thomas, but ... > > https://j3-fortran.org/doc/year/24/24-116.txt > > The exponentiation operator ** shall not be applied to UNSIGNED values. That was something

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 kargls at comcast dot net changed: What|Removed |Added CC||kargls at comcast dot net --

[Bug fortran/118499] Exponentiation of UNSIGNED is rejected

2025-01-15 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499 anlauf at gcc dot gnu.org changed: What|Removed |Added CC||tkoenig at gcc dot gnu.org -