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 codeSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned 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

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_
#ifdef __cplusplus
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_
#if defined _GNUC_STDC_INLINE_ || defined _GNUC_GNU_INLINE_
_attribute_ ((_gnu_inline_))
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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Nov 2016 05:45:38 PM UTChaibleStatusConfirmed=>Fixed
      Assigned toNone=>haible
    Sat 26 Nov 2016 02:30:21 AM UTChaibleStatusNone=>Confirmed
    Thu 24 Nov 2016 12:08:35 AM UTChaibleCategoryNone=>Generated code
    Wed 24 Dec 2014 04:49:46 AM UTCloozerCarbon-Copy-=>Added loozer

    Back to the top

    Powered by Savane 3.1-cleanup1