public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39748]  New: possible bogus offset warning
@ 2009-04-13  9:22 dcb314 at hotmail dot com
  2009-04-13  9:24 ` [Bug c/39748] " dcb314 at hotmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dcb314 at hotmail dot com @ 2009-04-13  9:22 UTC (permalink / raw)
  To: gcc-bugs

I just tried to compile the popular bzip2 package
with the GNU gcc version 4.5 snapshot 20090409.

The compiler said

bzlib.c: In function 'bzopen_or_bzdopen':
bzlib.c:1443: warning: offset '2' outside bounds of constant string
bzlib.c:1443: warning: offset '3' outside bounds of constant string

The source code is

     if (path==NULL || strcmp(path,"")==0) {

This looks like a bogus warning to me.

Preprocessed source code attached. No special flags required.


-- 
           Summary: possible bogus offset warning
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39748


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/39748] possible bogus offset warning
  2009-04-13  9:22 [Bug c/39748] New: possible bogus offset warning dcb314 at hotmail dot com
@ 2009-04-13  9:24 ` dcb314 at hotmail dot com
  2009-04-14 14:47 ` [Bug c/39748] [4.5 regression] warning "outside bounds of constant string" not suppressed in dead code falk at debian dot org
  2009-04-14 14:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dcb314 at hotmail dot com @ 2009-04-13  9:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dcb314 at hotmail dot com  2009-04-13 09:23 -------
Created an attachment (id=17624)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17624&action=view)
C source code


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39748


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/39748] [4.5 regression] warning "outside bounds of constant string" not suppressed in dead code
  2009-04-13  9:22 [Bug c/39748] New: possible bogus offset warning dcb314 at hotmail dot com
  2009-04-13  9:24 ` [Bug c/39748] " dcb314 at hotmail dot com
@ 2009-04-14 14:47 ` falk at debian dot org
  2009-04-14 14:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: falk at debian dot org @ 2009-04-14 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from falk at debian dot org  2009-04-14 14:47 -------
The problem comes from some convoluted code that was apparently substituted for
strlen to special-case constant arguments. It boils down to:

int f(void) {
  if (0)
    return ((const char *) "")[2];
  return 0;
}

(without the cast, no warning is given).


-- 

falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.5.0
      Known to work|                            |4.4.0
            Summary|possible bogus offset       |[4.5 regression] warning
                   |warning                     |"outside bounds of constant
                   |                            |string" not suppressed in
                   |                            |dead code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39748


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/39748] [4.5 regression] warning "outside bounds of constant string" not suppressed in dead code
  2009-04-13  9:22 [Bug c/39748] New: possible bogus offset warning dcb314 at hotmail dot com
  2009-04-13  9:24 ` [Bug c/39748] " dcb314 at hotmail dot com
  2009-04-14 14:47 ` [Bug c/39748] [4.5 regression] warning "outside bounds of constant string" not suppressed in dead code falk at debian dot org
@ 2009-04-14 14:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-14 14:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-04-14 14:50 -------


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


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39748


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-14 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-13  9:22 [Bug c/39748] New: possible bogus offset warning dcb314 at hotmail dot com
2009-04-13  9:24 ` [Bug c/39748] " dcb314 at hotmail dot com
2009-04-14 14:47 ` [Bug c/39748] [4.5 regression] warning "outside bounds of constant string" not suppressed in dead code falk at debian dot org
2009-04-14 14:51 ` 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).