Skip to content

Commit

Permalink
Merge pull request #1313 from basvodde/master
Browse files Browse the repository at this point in the history
gcc10 added to the build that failed the build. And the fix.
  • Loading branch information
basvodde committed Apr 21, 2020
2 parents 73add22 + b274656 commit a1a8c1f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -89,6 +89,7 @@ jobs:
- libc++-dev
- valgrind
- env: BUILD=docker_ubuntu_autotools
- env: BUILD=docker_ubuntu_gcc10

global:
- secure: |-
Expand Down
5 changes: 5 additions & 0 deletions scripts/travis_ci_build.sh
Expand Up @@ -100,6 +100,11 @@ if [ "x$BUILD" = "xdocker_ubuntu_autotools" ]; then
docker start -i cpputest_ubuntu
fi

if [ "x$BUILD" = "xdocker_ubuntu_gcc10" ]; then
$CPPUTEST_HOME/scripts/create_docker_images_and_containers gcc10
docker start -i cpputest_gcc10
fi

if [ "x$BUILD" = "xmake_dos" ]; then
wget http://ftp.openwatcom.org/install/open-watcom-c-linux-1.9 -O /tmp/watcom.zip
mkdir -p watcom && unzip -aqd watcom /tmp/watcom.zip && chmod -R +x watcom/binl
Expand Down
9 changes: 8 additions & 1 deletion tests/CppUTest/MemoryOperatorOverloadTest.cpp
Expand Up @@ -371,9 +371,16 @@ TEST(OutOfMemoryTestsForOperatorNew, FailingNewArrayOperatorReturnsNull)
* We (Bas Vodde and Terry Yin) suspect that in a real product, you wouldn't be able to detect the optimization and it's breaking of Standard C++. Therefore,
* for now, we keep this hack in the test to fool the optimizer and hope nobody will ever notice this 'optimizer behavior' in a real product.
*
* Update 2020: The gcc compiler implemented the same optimization, but it seems to be slightly smarter and discovered that we assign to a static variable.
* Thus it still optimized away the call to operator new. Did another bug report, but it is unlikely to get fixed. You can find it at:
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94671
*
* Changed the variable to be external so it would definitively be a mistake to optimize the call.
*
*/

static char* some_memory;
extern char* some_memory;
char* some_memory;

TEST(OutOfMemoryTestsForOperatorNew, FailingNewOperatorThrowsAnExceptionWhenUsingStdCppNewWithoutOverride)
{
Expand Down

0 comments on commit a1a8c1f

Please sign in to comment.