Bug 492973 - optimized strncmp macro creates odd warnings
optimized strncmp macro creates odd warnings
Status: CLOSED DUPLICATE of bug 492846
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-30 20:19 EDT by Bill Nottingham
Modified: 2014-03-16 23:18 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-30 20:25:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bill Nottingham 2009-03-30 20:19:44 EDT
[notting@nostromo: ~]$ cat foo.c
#include <stdio.h>
#include <string.h>

int main() {
        char *foo = "..";
        printf("%d\n", strncmp(foo, ".",1));
        return 0;
}
[notting@nostromo: ~]$ gcc -Wall -o foo foo.c  -O2
foo.c: In function ‘main’:
foo.c:6: warning: offset ‘3’ outside bounds of constant string

Turning off optimization (or parens around strncmp) fixes the warning.

Version-Release number of selected component (if applicable):

gcc-4.4.0-0.30.x86_64
glibc-devel-2.9.90-11.x86_64

How reproducible:

100%
Comment 1 Bill Nottingham 2009-03-30 20:25:13 EDT

*** This bug has been marked as a duplicate of bug 492846 ***

Note You need to log in before you can comment on or make changes to this bug.