Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icpc 11.1 bug.

tomleitner
Beginner
434 Views

Hi,

I'm facing the following bug in icpc 11.1. See comparison with g++ below.

addDays is defined as:

QDate addDays ( int ndays ) const

Below's what happens. Is this a known problem? Anyone any idea how to tackle that?

Thanks // Tom

root@avs1# cat t.cpp
#include

QDateTime timeOverPoint(const QDateTime& refTime)
{
QDate date = refTime.date();
qDebug("### date=%s dateAddDays=%s", date.toString().latin1(),
date.addDays(1).toString().latin1());

// this works:
QDate date1 = date.addDays(1);
qDebug("### date=%s", date1.toString().latin1());

// this fails and toString() returns a null string
date = date.addDays(1);
qDebug("### date=%s", date.toString().latin1());

return QDateTime(date, refTime.time());
}

main()
{
timeOverPoint(QDateTime(QDate(2009, 11, 1), QTime(10, 10, 10)));
}

root@avs1# g++ -g -o t t.cpp -I/usr/local/qt338/include -L/usr/local/qt338/lib -lqt-mt
root@avs1# ./t
### date=Sun Nov 1 2009 dateAddDays=Mon Nov 2 2009
### date=Mon Nov 2 2009
### date=Mon Nov 2 2009
root@avs1# icpc -g -o t t.cpp -I/usr/local/qt338/include -L/usr/local/qt338/lib -lqt-mt
root@avs1# ./t
### date=Sun Nov 1 2009 dateAddDays=Mon Nov 2 2009
### date=Mon Nov 2 2009
### date=(null)
root@avs1# icpc -V
Intel C++ Compiler Professional for applications running on IA-32, Version 11.1 Build 20091012 Package ID: l_cproc_p_11.1.059
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

0 Kudos
7 Replies
Dale_S_Intel
Employee
434 Views
Could you provide a .i file? I.e. compile with "icpc -g -o t t.cpp -I/usr/local/qt338/include -E > t.i". I can look into it, but would prefer not to have to install Qt to do it.

Thanks!

Dale

0 Kudos
tomleitner
Beginner
434 Views

Hi Dale,

Quoting - Dale Schouten (Intel)
Could you provide a .i file? I.e. compile with "icpc -g -o t t.cpp -I/usr/local/qt338/include -E > t.i". I can look into it, but would prefer not to have to install Qt to do it.

Thanks a lot for looking into it. Attached is the zipped output of:

icpc -g t.cpp -I/usr/local/qt338/include -E > t.i

Cheers // Tom

0 Kudos
Dale_S_Intel
Employee
434 Views
Quoting - tomleitner

Thanks a lot for looking into it. Attached is the zipped output of:

icpc -g t.cpp -I/usr/local/qt338/include -E > t.i

Cheers // Tom

Great, thanks. I can reproduce the problem you're seeing. Let me investigate and get back to you.

Dale

0 Kudos
tomleitner
Beginner
434 Views

Hi Dale,

Any news about this? Any progress?

Thanks and cheers // Tom

0 Kudos
Dale_S_Intel
Employee
434 Views

Hi Tom, sorry for the long delay. I'm still working on this, but I'll try to give you an update later this week.

Dale

0 Kudos
Dale_S_Intel
Employee
434 Views

OK Tom, I filed an issue on this (CQ149875, for future reference) but I'm still not 100% sure that the problem is with icc, it could be a g++ problem. When I look at it in the debugger, the gcc built library does something a little funky that looks like it's overwriting the contents of one of the parameters (i.e. *this) with a 0. I'm not sure we're doing something wrong or if gcc is. I wrote a small test case to just build addDays() and I can see the problem if I build it with gcc -O2 and build main with icc. If I build both with icc, or even if I build addDays with gcc -O0 then I don't see the problem. In short, one workaround maybe to build libqt-mt with icc, if that's feasible. In the meantime I've escalated this to our developers to get their feedback on it and will update you here when I learn more.

Thanks!

Dale

0 Kudos
tomleitner
Beginner
434 Views
Hi Dale,

Thanks for looking into this. Do you have any news about it form the developers?

Thanks a lot // Tom
0 Kudos
Reply