Bug 427634 - gcc-4.3 incorrectly warns about static data in an inline function
Summary: gcc-4.3 incorrectly warns about static data in an inline function
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-05 22:59 UTC by James Antill
Modified: 2008-01-30 08:57 UTC (History)
0 users

Fixed In Version: 4.3.0-0.7
Clone Of:
Environment:
Last Closed: 2008-01-30 08:57:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description James Antill 2008-01-05 22:59:35 UTC
Description of problem:

 GCC 4.3 incorrectly warns about "static const" data that is declared inside
an inline function. While warning about "static" data is correct, const isn't.

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

 Whatever is in:
koji build --scratch dist-f9-gcc43

Steps to Reproduce:
 The code looks like:

inline size_t ustr_xi__pow2(int use_big, unsigned char len)
{
  static const unsigned char map_big_pow2[4] = {2, 4, 8, 16};
  static const unsigned char map_pow2[4] = {0, 1, 2,  4};
  
  if (use_big)
    return (map_big_pow2[len & 0x03]);
  
  return (map_pow2[len & 0x03]);
}

...AIUI. this is the correct way to write the above function.


Additional info:

 This is mainly being built to make sure Ustr doesn't break the C99 inline
rules, which I think it doesn't due to the separate extern statement, however if
it is that might be contributing to the problem.

http://koji.fedoraproject.org/koji/getfile?taskID=327537&name=build.log

Comment 1 James Antill 2008-01-05 23:06:17 UTC
 It's in debian too, mainly here so I can update them:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450506

Comment 2 Jakub Jelinek 2008-01-30 08:57:36 UTC
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01432.html
Will be fixed in gcc-4.3.0-0.7.


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