public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times
@ 2023-01-29 19:06 rimvydas.jas at gmail dot com
2023-01-29 20:44 ` [Bug fortran/108592] " anlauf at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: rimvydas.jas at gmail dot com @ 2023-01-29 19:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
Bug ID: 108592
Summary: In IF statements -Winteger-division is repeated 4
times
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: rimvydas.jas at gmail dot com
Target Milestone: ---
$ cat intdiv.f90
program foo
if (8 < (20/9)) stop 8
end program
$ gfortran -Wall intdiv.f90
intdiv.f90:2:11:
2 | if (8 < (20/9)) stop 8
| 1
Warning: Integer division truncated to constant ‘2’ at (1) [-Winteger-division]
intdiv.f90:2:11:
2 | if (8 < (20/9)) stop 8
| 1
Warning: Integer division truncated to constant ‘2’ at (1) [-Winteger-division]
intdiv.f90:2:11:
2 | if (8 < (20/9)) stop 8
| 1
Warning: Integer division truncated to constant ‘2’ at (1) [-Winteger-division]
intdiv.f90:2:11:
2 | if (8 < (20/9)) stop 8
| 1
Warning: Integer division truncated to constant ‘2’ at (1) [-Winteger-division]
Diagnostic is given only twice for if/then/endif form:
if (8 < (20/9)) then ; endif
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/108592] In IF statements -Winteger-division is repeated 4 times
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
@ 2023-01-29 20:44 ` anlauf at gcc dot gnu.org
2023-01-30 21:01 ` tkoenig at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-29 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-01-29
Ever confirmed|0 |1
CC| |anlauf at gcc dot gnu.org,
| |tkoenig at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Patch that fixes the multiple warnings:
diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc
index 6de6d21c73d..d0d1c0b03d2 100644
--- a/gcc/fortran/arith.cc
+++ b/gcc/fortran/arith.cc
@@ -778,7 +778,7 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr
**resultp)
{
char *p;
p = mpz_get_str (NULL, 10, result->value.integer);
- gfc_warning_now (OPT_Winteger_division, "Integer division "
+ gfc_warning (OPT_Winteger_division, "Integer division "
"truncated to constant %qs at %L", p,
&op1->where);
free (p);
This also regtests cleanly.
@Thomas: do you remember the reason you chose the "_now" version?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/108592] In IF statements -Winteger-division is repeated 4 times
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
2023-01-29 20:44 ` [Bug fortran/108592] " anlauf at gcc dot gnu.org
@ 2023-01-30 21:01 ` tkoenig at gcc dot gnu.org
2023-01-30 21:57 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-01-30 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to anlauf from comment #1)
> @Thomas: do you remember the reason you chose the "_now" version?
I'm not sure any more. It's been a few years :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/108592] In IF statements -Winteger-division is repeated 4 times
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
2023-01-29 20:44 ` [Bug fortran/108592] " anlauf at gcc dot gnu.org
2023-01-30 21:01 ` tkoenig at gcc dot gnu.org
@ 2023-01-30 21:57 ` anlauf at gcc dot gnu.org
2023-02-05 21:53 ` cvs-commit at gcc dot gnu.org
2023-02-05 21:55 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-30 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to Thomas Koenig from comment #2)
> (In reply to anlauf from comment #1)
>
> > @Thomas: do you remember the reason you chose the "_now" version?
>
> I'm not sure any more. It's been a few years :-)
Alright, so let's try to be less "chatty":
https://gcc.gnu.org/pipermail/fortran/2023-January/058862.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/108592] In IF statements -Winteger-division is repeated 4 times
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
` (2 preceding siblings ...)
2023-01-30 21:57 ` anlauf at gcc dot gnu.org
@ 2023-02-05 21:53 ` cvs-commit at gcc dot gnu.org
2023-02-05 21:55 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-05 21:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:d042f118798ae0648b45f97e63b0e5ab7c82c8ef
commit r13-5705-gd042f118798ae0648b45f97e63b0e5ab7c82c8ef
Author: Harald Anlauf <anlauf@gmx.de>
Date: Mon Jan 30 22:46:43 2023 +0100
Fortran: prevent redundant integer division truncation warnings [PR108592]
gcc/fortran/ChangeLog:
PR fortran/108592
* arith.cc (gfc_arith_divide): Emit integer division truncation
warnings using gfc_warning instead of gfc_warning_now to prevent
redundant messages.
gcc/testsuite/ChangeLog:
PR fortran/108592
* gfortran.dg/pr108592.f90: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/108592] In IF statements -Winteger-division is repeated 4 times
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
` (3 preceding siblings ...)
2023-02-05 21:53 ` cvs-commit at gcc dot gnu.org
@ 2023-02-05 21:55 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-05 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108592
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|--- |13.0
Resolution|--- |FIXED
--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-13.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-05 21:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 19:06 [Bug fortran/108592] New: In IF statements -Winteger-division is repeated 4 times rimvydas.jas at gmail dot com
2023-01-29 20:44 ` [Bug fortran/108592] " anlauf at gcc dot gnu.org
2023-01-30 21:01 ` tkoenig at gcc dot gnu.org
2023-01-30 21:57 ` anlauf at gcc dot gnu.org
2023-02-05 21:53 ` cvs-commit at gcc dot gnu.org
2023-02-05 21:55 ` anlauf at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).