public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/45372] New: warning coverage.c assigns -1 to unsigned, suggest -1u
@ 2010-08-21 22:12 jay dot krell at cornell dot edu
2010-08-21 22:13 ` [Bug bootstrap/45372] " jay dot krell at cornell dot edu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: jay dot krell at cornell dot edu @ 2010-08-21 22:12 UTC (permalink / raw)
To: gcc-bugs
just a warning, not an error
bootstrapping from non-gcc
"/home/jay/src/gcc-4.5.1/gcc/coverage.c", line 174: warning: initializer does
not fit or is out of range: -1
"/home/jay/src/gcc-4.5.1/gcc/coverage.c", line 330: warning: initializer does
not fit or is out of range: -1
-bash-3.00$ uname -a
SunOS ssol 5.10 Generic_139555-08 sun4u sparc SUNW,Sun-Blade-100
/home/jay/src/gcc-4.5.1/configure \
-disable-shared \
-target=sparc64-sun-solaris2.10 \
-with-mpfr=/home/jay \
-disable-nls \
-prefix=/home/jay \
-disable-bootstrap \
-with-as=/usr/ccs/bin/as
read_counts_file (void)
...
gcov_unsigned_t checksum = -1; # line 174
gcov_type *
get_coverage_counts
...
gcov_unsigned_t checksum = -1; # line 330
bootstrap from:
-bash-3.00$ cc -V
cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
usage: cc [ options] files. Use 'cc -flags' for details
-1u gives no warning.
nor does (unsigned)-1
nor does, I suspect, (gcov_unsigned_t)-1
--
Summary: warning coverage.c assigns -1 to unsigned, suggest -1u
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jay dot krell at cornell dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45372
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/45372] warning coverage.c assigns -1 to unsigned, suggest -1u
2010-08-21 22:12 [Bug bootstrap/45372] New: warning coverage.c assigns -1 to unsigned, suggest -1u jay dot krell at cornell dot edu
@ 2010-08-21 22:13 ` jay dot krell at cornell dot edu
2010-08-22 8:17 ` schwab at linux-m68k dot org
2010-08-22 8:57 ` jay dot krell at cornell dot edu
2 siblings, 0 replies; 5+ messages in thread
From: jay dot krell at cornell dot edu @ 2010-08-21 22:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jay dot krell at cornell dot edu 2010-08-21 22:13 -------
clarification, where I assert what gives no warning, I was just testing with
like:
-bash-3.00$ cat 1.c
unsigned a = (unsigned)-1;
unsigned b = (0u - 1u);
I didn't yet test changing coverage.c.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45372
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/45372] warning coverage.c assigns -1 to unsigned, suggest -1u
2010-08-21 22:12 [Bug bootstrap/45372] New: warning coverage.c assigns -1 to unsigned, suggest -1u jay dot krell at cornell dot edu
2010-08-21 22:13 ` [Bug bootstrap/45372] " jay dot krell at cornell dot edu
@ 2010-08-22 8:17 ` schwab at linux-m68k dot org
2010-08-22 8:57 ` jay dot krell at cornell dot edu
2 siblings, 0 replies; 5+ messages in thread
From: schwab at linux-m68k dot org @ 2010-08-22 8:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from schwab at linux-m68k dot org 2010-08-22 08:16 -------
Assigning -1 to an unsigned type is always safe.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45372
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/45372] warning coverage.c assigns -1 to unsigned, suggest -1u
2010-08-21 22:12 [Bug bootstrap/45372] New: warning coverage.c assigns -1 to unsigned, suggest -1u jay dot krell at cornell dot edu
2010-08-21 22:13 ` [Bug bootstrap/45372] " jay dot krell at cornell dot edu
2010-08-22 8:17 ` schwab at linux-m68k dot org
@ 2010-08-22 8:57 ` jay dot krell at cornell dot edu
2 siblings, 0 replies; 5+ messages in thread
From: jay dot krell at cornell dot edu @ 2010-08-22 8:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jay dot krell at cornell dot edu 2010-08-22 08:56 -------
Best imho to put in the cast to quash the warning.
To be warning free -- esp. given how close you already are.
Sometimes I think warning-free across a range of compilers is untenable.
But you are in fact already very close.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45372
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/45372] warning coverage.c assigns -1 to unsigned, suggest -1u
[not found] <bug-45372-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-19 5:18 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-19 5:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45372
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |4.7.0
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Warnings during the first stage will not always be correct.
Anyways this has been fixed since r0-108388 which changes the code a lot and
removed the assignment.
So all fixed for GCC 4.7.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-19 5:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 22:12 [Bug bootstrap/45372] New: warning coverage.c assigns -1 to unsigned, suggest -1u jay dot krell at cornell dot edu
2010-08-21 22:13 ` [Bug bootstrap/45372] " jay dot krell at cornell dot edu
2010-08-22 8:17 ` schwab at linux-m68k dot org
2010-08-22 8:57 ` jay dot krell at cornell dot edu
[not found] <bug-45372-4@http.gcc.gnu.org/bugzilla/>
2021-07-19 5:18 ` pinskia 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).