buggperf - Bugs: bug #37071, plain inlines (with external...

 
 

bug #37071: plain inlines (with external linkage) cause havoc when mixed with internal linkage inlines

Submitted by:  Sebastian Freundt <hroptatyr>
Submitted on:  Fri 10 Aug 2012 12:50:03 PM UTC  
Votes:  1  
 
Category:  Generated code Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Bruno Haible <haible>
Open/Closed:  Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 26 Nov 2016 05:45:38 PM UTC, comment #3:

Thanks for the report.

The lookup function must not carry the inline specifier; this is a consequence of ISO C 99 6.7.4.

> in order for lookup function to have the same linkage as hashing one


This would have the effect of making the lookup function 'static' in C++ - which solves the inline problem but does not work for users who want to call the function from a different compilation unit.

So, I've removed the inline specifier on the lookup function.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Wed 23 Nov 2016 11:14:59 PM UTC, comment #2:

Citing http://www.devsuperpage.com/search/Articles.aspx?G=5&ArtID=186075 :

"6.7.4 Function specifiers
Syntax
function-specifier:
inline

Constraints
Function specifiers shall be used only in the declaration of an
identifier for a function. An inline definition of a function
with external linkage shall not contain a definition of a
modifiable object with static storage duration, and shall not
^^^^^^^^^^^^^
contain a reference to an identifier with internal linkage."

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Wed 24 Dec 2014 04:48:12 AM UTC, comment #1:

Well, the main question is why it was made with internal linkage in first place. If it's just a link-time optimization then it can be safely thrown away. Also, in order for lookup function to have the same linkage as hashing one
should be added to attributes. In this way not only the original bug is fixed, but related compilation problem is resolved as well.

Sergii Strelkovskyi <loozer>
Fri 10 Aug 2012 12:50:03 PM UTC, original submission:

The emitted code

#ifdef _GNUC_
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
__tid_hash (register const char *str, register unsigned int len)
{
...
}

has internal linkage (as per the static keyword).

In contrast, a few lines down the road:

#ifdef _GNUC_
__inline
#if defined _GNUC_STDC_INLINE_ || defined _GNUC_GNU_INLINE_
_attribute_ ((_gnu_inline_))
#endif
#endif
const struct tws_xml_tag_s *
__tiddify (register const char *str, register unsigned int len)
{
...
register int key = __tid_hash (str, len);
...
}

there's a reference from a function with external linkage (as per the plain inline) to a function with internal linkage.

This results in a warning:

../../src/proto-twsxml-tag.gperf(28): warning #1173: an entity with internal linkage cannot be referenced within an inline function with external linkage

Suggested fix:
Both functions (maybe optionally) should have internal linkage.

Sebastian Freundt <hroptatyr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by loozer (Voted in favor of this item)
  • -email is unavailable- added by loozer (Posted a comment)
  • -email is unavailable- added by hroptatyr (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-26 haible StatusConfirmed => Fixed
        Assigned toNone => haible
        Open/ClosedOpen => Closed
    2016-11-26 haible StatusNone => Confirmed
    2016-11-24 haible CategoryNone => Generated code
    2014-12-24 loozer Carbon-Copy- => Added loozer

    Back to the top


    Powered by Savane 3.3