Bug 344152 - /usr/include/kdevplatform/language/util/setrepository.h:57:38: warning: returning reference to temporary [-Wreturn-local-addr]
Summary: /usr/include/kdevplatform/language/util/setrepository.h:57:38: warning: retur...
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 4.7.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-14 11:35 UTC by Markus Trippelsdorf
Modified: 2015-10-11 13:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2015-02-14 11:35:38 UTC
gcc-5 warns:
In file included from /usr/include/kdevplatform/language/duchain/topducontext.h:24:0,
                 from /usr/include/kdevplatform/language/duchain/parsingenvironment.h:32,
                 from /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/cpppreprocessenvironment.h:17,
                 from /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/cpppreprocessenvironment.cpp:14:
/usr/include/kdevplatform/language/util/setrepository.h: In instantiation of ‘const T& Utils::ConvenientIterator<T, Conversion>::ref() const [with T = KDevelop::IndexedString
; Conversion = Cpp::IndexedStringConversion]’:
/var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/cpppreprocessenvironment.cpp:120:36:   required from here
/usr/include/kdevplatform/language/util/setrepository.h:57:38: warning: returning reference to temporary [-Wreturn-local-addr]
       return Conversion::toItem(*m_it);
     
In file included from /usr/include/kdevplatform/language/duchain/topducontext.h:24:0,
                 from /usr/include/kdevplatform/language/duchain/parsingenvironment.h:32,
                 from /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/environmentmanager.h:23,
                 from /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/environmentmanager.cpp:14:
/usr/include/kdevplatform/language/util/setrepository.h: In instantiation of ‘const T& Utils::ConvenientIterator<T, Conversion>::ref() const [with T = KDevelop::IndexedString
; Conversion = Cpp::IndexedStringConversion]’:
/var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/environmentmanager.cpp:235:48:   required from here
/usr/include/kdevplatform/language/util/setrepository.h:57:38: warning: returning reference to temporary [-Wreturn-local-addr]
       return Conversion::toItem(*m_it);
    
The resulting binary crashes.

Reproducible: Always
Comment 1 Kevin Funk 2015-02-14 11:47:49 UTC
Please get a backtrace of the crash. Is it related to warning?

That warning was spit out since forever, it's legacy code.
Comment 2 Markus Trippelsdorf 2015-02-14 12:01:18 UTC
(In reply to Kevin Funk from comment #1)
> Please get a backtrace of the crash. Is it related to warning?

Yes it is:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff4bfff700 (LWP 3227)]
QHash<KDevelop::IndexedString, QHashDummyValue>::findNode (this=this@entry=0x7fff44003b80, akey=..., ahp=ahp@entry=0x7fff4bffd630) at /usr/include/qt4/QtCore/qhash.h:882
882         uint h = qHash(akey);
(gdb) bt
#0  QHash<KDevelop::IndexedString, QHashDummyValue>::findNode (this=this@entry=0x7fff44003b80, akey=..., ahp=ahp@entry=0x7fff4bffd630) at /usr/include/qt4/QtCore/qhash.h:882
#1  0x00007fff68421d71 in insert (avalue=..., akey=..., this=0x7fff44003b80) at /usr/include/qt4/QtCore/qhash.h:759
#2  insert (value=..., this=0x7fff44003b80) at /usr/include/qt4/QtCore/qset.h:181
#3  CppPreprocessEnvironment::merge (this=0x7fff44003b50, file=0x7fff44017820, mergeEnvironment=mergeEnvironment@entry=true)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/cppduchain/cpppreprocessenvironment.cpp:120
#4  0x00007fff684f0334 in PreprocessJob::sourceNeeded (this=0xa4ff50, _fileName=..., type=<optimized out>, sourceLine=19, skipCurrentPath=<optimized out>)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/preprocessjob.cpp:547
#5  0x00007fff682ec17c in rpp::pp::handle_include (this=this@entry=0x7fff4bffdcc0, skip_current_path=<optimized out>, input=..., output=...)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/parser/rpp/pp-engine.cpp:219
#6  0x00007fff682f0287 in rpp::pp::handle_directive (this=this@entry=0x7fff4bffdcc0, directive=directive@entry=76067, input=..., output=...)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/parser/rpp/pp-engine.cpp:137
#7  0x00007fff682f082c in rpp::pp::operator() (this=this@entry=0x7fff4bffdcc0, input=..., output=...)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/parser/rpp/pp-engine.cpp:272
#8  0x00007fff682f0b13 in rpp::pp::processFileInternal (this=this@entry=0x7fff4bffdcc0, fileName=..., fileContents=..., result=...)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/parser/rpp/pp-engine.cpp:98
#9  0x00007fff682f0ea5 in rpp::pp::processFile (this=this@entry=0x7fff4bffdcc0, fileName=..., data=...)
    at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/parser/rpp/pp-engine.cpp:85
#10 0x00007fff684f2bac in PreprocessJob::run (this=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-4.7.1/work/kdevelop-4.7.1/languages/cpp/preprocessjob.cpp:249
#11 0x00007ffff1837162 in ThreadWeaver::JobRunHelper::runTheJob(ThreadWeaver::Thread*, ThreadWeaver::Job*) () from /usr/lib/libthreadweaver.so.4
#12 0x00007ffff183735e in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#13 0x00007ffff1838fdb in ThreadWeaver::JobCollectionJobRunner::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#14 0x00007ffff183699b in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#15 0x00007ffff5c464fc in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#16 0x00007ffff4a953e6 in start_thread () from /lib/libpthread.so.0
#17 0x00007ffff57a26cd in clone () from /lib/libc.so.6
Comment 3 Kevin Funk 2015-02-14 12:13:29 UTC
Is this reproducible? If yes, please tell us how to reproduce.

And/or try to fix the warning and check if that solves the issue for you. That would be greatly appreciated.
Comment 4 Markus Trippelsdorf 2015-02-14 12:17:40 UTC
(In reply to Kevin Funk from comment #3)
> Is this reproducible? If yes, please tell us how to reproduce.

Yes. Just compile Kdevelop with gcc-5 and then open a C++ file with it.
Kdevelop will crash almost immediately.

> And/or try to fix the warning and check if that solves the issue for you.
> That would be greatly appreciated.

Will look into this next week.
Comment 5 Sven Brauch 2015-10-11 13:03:55 UTC
Never seen this, I assume it's fixed by now, if not please reopen.