public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22389] New: strlen from Function possible
@ 2005-07-09 19:29 kleinalex at gmx dot at
2005-07-09 19:40 ` [Bug c/22389] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: kleinalex at gmx dot at @ 2005-07-09 19:29 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]
Boyer-Search.c file:
int Search (char search[],char Text[]){
unsigned int Plen = strlen(Search)-1; // The Bug! S instead of s
unsigned int Textlength = strlen(Text)-1;
int Pattern[256];
int i;int j;int k;
int Position = Plen;
for (i = 0; i < 256; i++){
Pattern[i] = Plen;
}
for (i = Plen; i > 0; i--){
Pattern[search[i]] = i;
}
do {
j = Plen;
k = Position;
do {
j--;
k--;
} while (search[j] == Text[k] && j >= 0);
Position = Position + Pattern[Text[k]];
} while (Position < Textlength && j >= 0);
return Position;
}
gcc-4.0 -pg -ggdb -gstabs+ -fprofile-arcs -ftest-coverage -Wall -o BoyerMoore_Te
xtSuche Boyer-Search.c main.c
Boyer-Search.c: In function Search:
Boyer-Search.c:3: Warnung: implizite Deklaration der Funktion strlen
Boyer-Search.c:3: Warnung: unverträgliche implizite Deklaration der eingebauten
Funktion strlen
Boyer-Search.c:3: Warnung: Übergabe des Arguments 1 von strlen von inkompatibl
em Zeigertyp
Boyer-Search.c:14: Warnung: Feldindex hat Typ char
Boyer-Search.c:24: Warnung: Feldindex hat Typ char
gcc give only warnings!
--
Summary: strlen from Function possible
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kleinalex at gmx dot at
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22389
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/22389] strlen from Function possible
2005-07-09 19:29 [Bug c/22389] New: strlen from Function possible kleinalex at gmx dot at
@ 2005-07-09 19:40 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-09 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-09 19:29 -------
Since you did not give a prototype of strlen (by including string.h), the C standard talks about implicit
functions prototype and gives in this case strlen a prototype that takes a function type.
If you include string.h you will get a warning about incompatiable pointers which is what GCC emits as
GCC has an extension that implicitly converts any pointer to another without a cast. If you want an
error in that case use -pedantic-error.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22389
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-09 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-09 19:29 [Bug c/22389] New: strlen from Function possible kleinalex at gmx dot at
2005-07-09 19:40 ` [Bug c/22389] " pinskia 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).