Bug 492973 - optimized strncmp macro creates odd warnings
Summary: optimized strncmp macro creates odd warnings
Keywords:
Status: CLOSED DUPLICATE of bug 492846
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-31 00:19 UTC by Bill Nottingham
Modified: 2014-03-17 03:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-31 00:25:13 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bill Nottingham 2009-03-31 00:19:44 UTC
[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-31 00:25:13 UTC

*** 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.