This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/82302] LTO producing bad code


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #16 from Martin Liška <marxin at gcc dot gnu.org> ---
But this is problem:

diff --git a/Source/World/Chunk/Chunk.cpp b/Source/World/Chunk/Chunk.cpp
index 297d3d7..9b75347 100644
--- a/Source/World/Chunk/Chunk.cpp
+++ b/Source/World/Chunk/Chunk.cpp
@@ -43,6 +43,7 @@ void Chunk::setBlock(int x, int y, int z, ChunkBlock block)
         while (!highBlock.getData().isOpaque)
         {
             highBlock = getBlock(x, y--, z);
+         assert (highBlock != 0);
         }
     }
     else if (y > m_highestBlocks.get(x, z))

Triggers even with -O0 and without LTO:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x0000155553909691 in __GI_abort () at abort.c:79
#2  0x00001555539006da in __assert_fail_base (fmt=0x155553a52e68 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x43a00b "highBlock
!= 0", 
    file=file@entry=0x439fb8
"/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Chunk/Chunk.cpp",
line=line@entry=46, 
    function=function@entry=0x43a040 <Chunk::setBlock(int, int, int,
ChunkBlock)::__PRETTY_FUNCTION__> "virtual void Chunk::setBlock(int, int, int,
ChunkBlock)") at assert.c:92
#3  0x0000155553900752 in __GI___assert_fail (assertion=0x43a00b "highBlock !=
0", file=0x439fb8
"/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Chunk/Chunk.cpp",
line=46, 
    function=0x43a040 <Chunk::setBlock(int, int, int,
ChunkBlock)::__PRETTY_FUNCTION__> "virtual void Chunk::setBlock(int, int, int,
ChunkBlock)") at assert.c:101
#4  0x000000000042f68f in Chunk::setBlock (this=0x15553c011900, x=13, y=91,
z=8, block=...) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Chunk/Chunk.cpp:46
#5  0x00000000004273b2 in StructureBuilder::build (this=0x1555459d1a50,
chunk=...) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Generation/Structures/StructureBuilder.cpp:11
#6  0x0000000000426d8b in makeOakTree (chunk=..., rand=..., x=13, y=88, z=8) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Generation/Structures/TreeGenerator.cpp:73
#7  0x00000000004242a5 in LightForest::makeTree (this=0x992be8, rand=...,
chunk=..., x=13, y=88, z=8) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Generation/Biome/LightForest.cpp:25
#8  0x00000000004253dc in ClassicOverWorldGenerator::setBlocks (this=0x992290,
maxHeight=105) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp:198
#9  0x0000000000424aa3 in ClassicOverWorldGenerator::generateTerrainFor
(this=0x992290, chunk=...) at
/home/marxin/Programming/MineCraft-One-Week-Challenge/Source/World/Generation/Terrain/ClassicOverWorldGenerator.cpp:61

Note that you can't call a function for null argument.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]