public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/42406] New: gcc issues warning with tolower function with optimization flag
@ 2009-12-17 15:02 joe dot bassis at gmail dot com
2009-12-17 16:20 ` [Bug c/42406] " rguenth at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: joe dot bassis at gmail dot com @ 2009-12-17 15:02 UTC (permalink / raw)
To: gcc-bugs
gcc issues warning when using the tolower function along with an optimization
flag. This warning also happens in other versions of gcc apart from 4.4.2
gcc -std=c99 -pedantic -O2 -Wall -Wunreachable-code a.c
a.c:13: warning: will never be executed
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
char A[50] = "";
strcat(A, "Hello World!");
int COUNT = 0;
while(A[COUNT])
{
A[COUNT] = (char)(tolower(A[COUNT])); // this line issues warning
COUNT++;
}
puts(A); // output: hello world!
return 0;
}
--
Summary: gcc issues warning with tolower function with
optimization flag
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: joe dot bassis at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42406
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/42406] gcc issues warning with tolower function with optimization flag
2009-12-17 15:02 [Bug c/42406] New: gcc issues warning with tolower function with optimization flag joe dot bassis at gmail dot com
@ 2009-12-17 16:20 ` rguenth at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-17 16:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-12-17 16:20 -------
-Wunreachable-code is broken and has been removed in 4.5.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42406
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-17 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-17 15:02 [Bug c/42406] New: gcc issues warning with tolower function with optimization flag joe dot bassis at gmail dot com
2009-12-17 16:20 ` [Bug c/42406] " rguenth at gcc dot gnu dot 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).