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)
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  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:
Last Closed: 2009-03-30 20:25:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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):


How reproducible:

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.