Bug 44846 - Violation of one-definition rule
Summary: Violation of one-definition rule
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 20357
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-06 20:43 UTC by Jan Hubicka
Modified: 2021-08-02 13:20 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-06 21:10:04


Attachments
testcase (108.38 KB, text/plain)
2010-07-06 20:49 UTC, Jan Hubicka
Details
Workaround patch to let mozilla build to proceed. (1002 bytes, patch)
2010-07-06 21:23 UTC, Jan Hubicka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hubicka 2010-07-06 20:43:14 UTC
./xgcc -B ./ -O2 jsnum.ii  -fdump-ipa-all
leads to two cgraph nodes to the same asm name:
jsval js::ValueToNumberSlow(JSContext*, jsval, double*)/1083(913) @0x7ffff613b810 (asm: _ZN2js17ValueToNumberSlowEP9JSContextlPd) analyzed 276 time, 36 benefit 114 size, 27 benefit needed reachable body finalized inlinable
  called by: bool js::ValueToNumberValueSlow(JSContext*, jsval*, double*)/1084 (1.00 per call) (can throw external) bool js::ValueToNumberValueSlow(JSContext*, jsval*)/1085 (1.00 per call) (can throw external) bool js::ValueToECMAInt32Slow(JSContext*, jsval, int32_t*)/1086 (1.00 per call) (can throw external) bool js::ValueToECMAUint32Slow(JSContext*, jsval, uint32_t*)/1087 (1.00 per call) (can throw external) bool js::ValueToInt32Slow(JSContext*, jsval, int32_t*)/1089 (1.00 per call) (can throw external) bool js::ValueToUint16Slow(JSContext*, jsval, uint16_t*)/1090 (1.00 per call) (can throw external)
  calls: JSBool JSVAL_IS_PRIMITIVE(jsval)/50 (1.00 per call) JSBool JSObject::defaultValue(JSContext*, JSType, jsval*)/485 (1.00 per call) (can throw external) JSObject* JSVAL_TO_OBJECT(jsval)/53 (1.00 per call) JSBool JSVAL_IS_VOID(jsval)/49 (1.00 per call) jsval INT_TO_JSVAL(jsint)/60 (1.00 per call) JSBool JSVAL_IS_NULL(jsval)/48 (1.00 per call) jsval INT_TO_JSVAL(jsint)/60 (1.00 per call) jsval INT_TO_JSVAL(jsint)/60 (1.00 per call) JSBool JSVAL_TO_BOOLEAN(jsval)/61 (1.00 per call) JSBool JSVAL_IS_BOOLEAN(jsval)/47 (1.00 per call) int JSDOUBLE_IS_NaN(jsdouble)/821 (1.00 per call) T js::StringToNumberType(JSContext*, JSString*) [with T = double, JSContext = JSContext, JSString = JSString]/1144 (1.00 per call) (can throw external) JSString* JSVAL_TO_STRING(jsval)/55 (1.00 per call) JSBool JSVAL_IS_STRING(jsval)/45 (1.00 per call) jsdouble* JSVAL_TO_DOUBLE(jsval)/54 (1.00 per call) JSBool JSVAL_IS_DOUBLE(jsval)/43 (1.00 per call) jsint JSVAL_TO_INT(jsval)/59 (1.00 per call) JSBool JSVAL_IS_INT(jsval)/42 (1.00 per call)
  References:  var:jsdouble js_NaN (read)
  Refering this function:

and
jsval js::ValueToNumberSlow(JSContext*, jsval, double*)/1294(-1) @0x7ffff5f4d968 (asm: _ZN2js17ValueToNumberSlowEP9JSContextlPd) availability:not_available reachable
  called by:
  calls:
  References:
  Refering this function:

this eventually leads to confussion in my new symtab code that eventually confuses gold and leads to mozilla build failure.

Honza
Comment 1 Jan Hubicka 2010-07-06 20:49:09 UTC
Created attachment 21114 [details]
testcase
Comment 2 Andrew Pinski 2010-07-06 20:51:55 UTC
This is a front-end issue. There is another bug about this issue too.
Comment 3 Andrew Pinski 2010-07-06 20:53:16 UTC
PR 20357.
Comment 4 Jan Hubicka 2010-07-06 21:06:11 UTC
Subject: Re:  Violation of one-definition rule

Mine is bit more stuble since the duplicated decl does nolead to linker error
unless LTO is used, but might be same or smilar problem.
I made workaround for now and can confirm that the wrong decl is used in call that
appears already in .eh dump, so it comes from frontend.

This is something that really ought to be fixed... Seem it is there for a while.

Honza
Comment 5 Andrew Pinski 2010-07-06 21:09:55 UTC
>Mine is bit more stuble 

It might be more subtle but it is the same issue, as we have two FUNCTION_DECL which are the same:
__attribute__((always_inline)) inline bool
ValueToNumber(JSContext *cx, jsval v, double *out)
{

....
    extern jsval ValueToNumberSlow(JSContext *, jsval, double *);
    return !JSVAL_IS_NULL(ValueToNumberSlow(cx, v, out));
}

....
namespace js {

jsval
ValueToNumberSlow(JSContext *cx, jsval v, double *out)
{
...

Which points to the same issue as PR 20357 where we have the same semantic issue of the function decls.
Comment 6 Jan Hubicka 2010-07-06 21:23:14 UTC
Created attachment 21115 [details]
Workaround patch to let mozilla build to proceed.
Comment 7 Jan Hubicka 2011-01-08 21:28:15 UTC
The workaround was comitted to the mainline, but the duplicated decl issue probably remains.
Comment 8 Jan Hubicka 2011-01-10 14:39:06 UTC
With workaround we no longer affect mozilla.