bugThe FreeType Project - Bugs: bug #27441, Fix of bug#26849 makes C++...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #27441: Fix of bug#26849 makes C++ compilation fail

Submitter:  suzuki toshiya <mpsuzuki>
Submitted:  Mon 14 Sep 2009 01:10:55 AM UTC
   
 
Severity:  5 - Blocker Item Group:  Hack required
Status:  Fixed Privacy:  Public
Assigned to:  mpsuzuki Open/Closed:  Closed
Planned Release:  2.3.10

Jump to the original submission

Tue 29 Sep 2009 05:46:10 PM UTC, comment #21: 

Just I've committed the 4th fix to git head.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 28 Sep 2009 06:24:35 PM UTC, comment #20: 

The reporter of navit crash (Adam) said OK.
I will commit attached patch to git head soon.
By the insertion of FT_CMAP_NODE() etc,
some lines becomes too long, I folded them.

diff --git a/ChangeLog b/ChangeLog
index 4d981d1..f5cfeda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2009-09-27  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+ [cache] Fix Savannah bug #27441, cleanup Redhat bugzilla #513582.
+ Tricky casts in FTC_{CACHE,GCACHE,MRULIST}_LOOKUP_CMP()
+ are removed. Now these functions should be called with
+ FTC_Node or FTC_MruNode variable, and the caller should
+ cast them to appropriate pointers to concrete data.
+ These tricky casts can GCC-4.4 optimizer (-O2) confused
+ and the crashing binaries are generated.
+
+ * src/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Drop tricky
+ cast. Now the 4th argument `node' of this function should
+ be typed as FTC_MruNode.
+
+ * src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP): For inline
+ implementation, new temporal variable FTC_MruNode `_mrunode'
+ to take the pointer from FTC_MRULIST_LOOKUP_CMP().  For non
+ inline implementation, tricky cast is dropped.
+
+ * src/cache/ftcmanag.c (FTC_SIZE_NODE): New macro casting
+ to FTC_SizeNode.
+ (FTC_Manager_LookupSize): Replace FTC_SizeNode `node' by
+ FTC_MruNode `mrunode', and FTC_SIZE_NODE() is inserted.
+ (FTC_FACE_NODE): New macro casting to FTC_FaceNode.
+ (FTC_Manager_LookupFace) Replace FTC_FaceNode `node' by
+ FTC_MruNode `mrunode', and FTC_FACE_NODE() is inserted.
+
+ * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Change
+ the type of `node' from FTC_INode to FTC_Node.  Extra
+ casting macro FTC_NODE() is dropped.
+ (FTC_ImageCache_LookupScaler): Ditto.
+ (FTC_SBitCache_Lookup): Change the type of `node' from
+ FTC_SNode to FTC_Node.  Extra casting macro FTC_NODE()
+ is dropped.  FTC_SNODE() is inserted.
+ (FTC_SBitCache_LookupScaler): Ditto.
+
+ * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Change
+ the type of `node' from FTC_CMapNode to FTC_Node.  Extra
+ casting macro FTC_NODE() is dropped, FTC_CMAP_NODE() is
+ inserted.
+
 2009-09-25  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
  [cache, psaux, type1] Fix for multi build.
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index f9c75f3..ebc8871 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -316,7 +316,7 @@
                          FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
-    FTC_INode          node = 0;  /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_Error           error;
     FT_UInt32          hash;
 
@@ -383,7 +383,7 @@
     error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                                hash, gindex,
                                FTC_GQUERY( &query ),
-                               (FTC_Node*) &node );
+                               &node );
 #endif
     if ( !error )
     {
@@ -391,8 +391,8 @@
 
       if ( anode )
       {
-        *anode = FTC_NODE( node );
-        FTC_NODE( node )->ref_count++;
+        *anode = node;
+        node->ref_count++;
       }
     }
 
@@ -412,7 +412,7 @@
                                FTC_Node       *anode )
   {
     FTC_BasicQueryRec  query;
-    FTC_INode          node = 0;  /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_Error           error;
     FT_UInt32          hash;
 
@@ -453,8 +453,8 @@
 
       if ( anode )
       {
-        *anode = FTC_NODE( node );
-        FTC_NODE( node )->ref_count++;
+        *anode = node;
+        node->ref_count++;
       }
     }
 
@@ -655,7 +655,7 @@
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
-    FTC_SNode          node = 0; /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_UInt32          hash;
 
 
@@ -721,17 +721,18 @@
                                hash,
                                gindex,
                                FTC_GQUERY( &query ),
-                               (FTC_Node*)&node );
+                               &node );
 #endif
     if ( error )
       goto Exit;
 
-    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
+    *ansbit = FTC_SNODE( node )->sbits +
+              ( gindex - FTC_GNODE( node )->gindex );
 
     if ( anode )
     {
-      *anode = FTC_NODE( node );
-      FTC_NODE( node )->ref_count++;
+      *anode = node;
+      node->ref_count++;
     }
 
   Exit:
@@ -751,7 +752,7 @@
   {
     FT_Error           error;
     FTC_BasicQueryRec  query;
-    FTC_SNode          node = 0; /* make compiler happy */
+    FTC_Node           node = 0; /* make compiler happy */
     FT_UInt32          hash;
 
 
@@ -788,12 +789,13 @@
     if ( error )
       goto Exit;
 
-    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
+    *ansbit = FTC_SNODE( node )->sbits +
+              ( gindex - FTC_GNODE( node )->gindex );
 
     if ( anode )
     {
-      *anode = FTC_NODE( node );
-      FTC_NODE( node )->ref_count++;
+      *anode = node;
+      node->ref_count++;
     }
 
   Exit:
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 50a6189..a802b05 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -283,7 +283,7 @@
   {
     FTC_Cache         cache = FTC_CACHE( cmap_cache );
     FTC_CMapQueryRec  query;
-    FTC_CMapNode      node;
+    FTC_Node          node;
     FT_Error          error;
     FT_UInt           gindex = 0;
     FT_UInt32         hash;
@@ -373,18 +373,21 @@
     FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
                           node, error );
 #else
-    error = FTC_Cache_Lookup( cache, hash, &query, (FTC_Node*) &node );
+    error = FTC_Cache_Lookup( cache, hash, &query, &node );
 #endif
     if ( error )
       goto Exit;
 
-    FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
+    FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
+                FTC_CMAP_INDICES_MAX );
 
     /* something rotten can happen with rogue clients */
-    if ( (FT_UInt)( char_code - node->first >= FTC_CMAP_INDICES_MAX ) )
+    if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
+                    FTC_CMAP_INDICES_MAX ) )
       return 0;
 
-    gindex = node->indices[char_code - node->first];
+    gindex = FTC_CMAP_NODE( node )->indices[char_code -
+                                            FTC_CMAP_NODE( node )->first];
     if ( gindex == FTC_CMAP_UNKNOWN )
     {
       FT_Face  face;
@@ -392,7 +395,9 @@
 
       gindex = 0;
 
-      error = FTC_Manager_LookupFace( cache->manager, node->face_id, &face );
+      error = FTC_Manager_LookupFace( cache->manager,
+                                      FTC_CMAP_NODE( node )->face_id,
+                                      &face );
       if ( error )
         goto Exit;
 
@@ -413,7 +418,9 @@
           FT_Set_Charmap( face, old );
       }
 
-      node->indices[char_code - node->first] = (FT_UShort)gindex;
+      FTC_CMAP_NODE( node )->indices[char_code -
+                                     FTC_CMAP_NODE( node )->first]
+        = (FT_UShort)gindex;
     }
 
   Exit:
diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h
index 87a4199..c18f9c3 100644
--- a/src/cache/ftcglyph.h
+++ b/src/cache/ftcglyph.h
@@ -277,12 +277,14 @@ FT_BEGIN_HEADER
     FTC_GCache               _gcache   = FTC_GCACHE( cache );               \
     FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \
     FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
+    FTC_MruNode              _mrunode;                                      \
                                                                             \
                                                                             \
     _gquery->gindex = (gindex);                                             \
                                                                             \
     FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \
-                            _gquery->family, error );                       \
+                            _mrunode, error );                              \
+    _gquery->family = FTC_FAMILY( _mrunode );                               \
     if ( !error )                                                           \
     {                                                                       \
       FTC_Family  _gqfamily = _gquery->family;                              \
@@ -303,11 +305,10 @@ FT_BEGIN_HEADER
 #define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,          \
                                gindex, query, node, error )           \
    FT_BEGIN_STMNT                                                     \
-     void*  _n = &(node);                                             \
-                                                                      \
                                                                       \
      error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,    \
-                                FTC_GQUERY( query ), (FTC_Node*)_n ); \
+                                FTC_GQUERY( query ), node );          \
+                                                                      \
    FT_END_STMNT
 
 #endif /* !FTC_INLINE */
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 8436bd0..f2a298e 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -82,6 +82,8 @@
 
   } FTC_SizeNodeRec, *FTC_SizeNode;
 
+#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) )
+
 
   FT_CALLBACK_DEF( void )
   ftc_size_node_done( FTC_MruNode  ftcnode,
@@ -180,8 +182,8 @@
                           FTC_Scaler   scaler,
                           FT_Size     *asize )
   {
-    FT_Error      error;
-    FTC_SizeNode  node;
+    FT_Error     error;
+    FTC_MruNode  mrunode;
 
 
     if ( asize == NULL )
@@ -195,14 +197,14 @@
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,
-                            node, error );
+                            mrunode, error );
 
 #else
-    error = FTC_MruList_Lookup( &manager->sizes, scaler, (FTC_MruNode*)&node );
+    error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );
 #endif
 
     if ( !error )
-      *asize = node->size;
+      *asize = FTC_SIZE_NODE( mrunode )->size;
 
     return error;
   }
@@ -224,6 +226,8 @@
 
   } FTC_FaceNodeRec, *FTC_FaceNode;
 
+#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) )
+
 
   FT_CALLBACK_DEF( FT_Error )
   ftc_face_node_init( FTC_MruNode  ftcnode,
@@ -305,8 +309,8 @@
                           FTC_FaceID   face_id,
                           FT_Face     *aface )
   {
-    FT_Error      error;
-    FTC_FaceNode  node;
+    FT_Error     error;
+    FTC_MruNode  mrunode;
 
 
     if ( aface == NULL )
@@ -321,14 +325,14 @@
 #ifdef FTC_INLINE
 
     FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,
-                            node, error );
+                            mrunode, error );
 
 #else
-    error = FTC_MruList_Lookup( &manager->faces, face_id, (FTC_MruNode*)&node );
+    error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );
 #endif
 
     if ( !error )
-      *aface = node->face;
+      *aface = FTC_FACE_NODE( mrunode )->face;
 
     return error;
   }
diff --git a/src/cache/ftcmru.h b/src/cache/ftcmru.h
index 0cda76e..5739439 100644
--- a/src/cache/ftcmru.h
+++ b/src/cache/ftcmru.h
@@ -163,7 +163,7 @@ FT_BEGIN_HEADER
   FT_BEGIN_STMNT                                                            \
     FTC_MruNode*             _pfirst  = &(list)->nodes;                     \
     FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \
-    FTC_MruNode              _first, _node, *_pnode;                        \
+    FTC_MruNode              _first, _node;                                 \
                                                                             \
                                                                             \
     error  = 0;                                                             \
@@ -180,8 +180,7 @@ FT_BEGIN_HEADER
           if ( _node != _first )                                            \
             FTC_MruNode_Up( _pfirst, _node );                               \
                                                                             \
-          _pnode = (FTC_MruNode*)(void*)&(node);                            \
-          *_pnode = _node;                                                  \
+          node = _node;                                                     \
           goto _MruOk;                                                      \
         }                                                                   \
         _node = _node->next;                                                \


(file #18791)

suzuki toshiya <mpsuzuki>
Group administrator
Sat 26 Sep 2009 04:24:29 PM UTC, comment #19: 

This is the 4th solution.

When cpp functions FTC_CACHE_LOOKUP_CMP() etc are called,
the caller pass the pointer to FTC_Node (or FTC_MruNode),
and cast the results to the pointer to concrete data types (e.g.
FTC_CMapNode, etc) in the caller.

I will upload the patch and source rpm to Redhat bugzilla and
wait their comment.

(file #18781)

suzuki toshiya <mpsuzuki>
Group administrator
Sat 26 Sep 2009 12:27:30 PM UTC, comment #18: 

The patch inserting the unions was commented negative,
because C standard does not guarantee that the members
of union are overlapped in the memory. I will rework.

suzuki toshiya <mpsuzuki>
Group administrator
Sat 26 Sep 2009 12:17:16 PM UTC, comment #17: 

I proposed my patch dropping node = NULL initialization
to Fedora Core developers. The reporter of crashing navit
(Adam) said it's OK, but other developers (Behdad and Kevin)
told that my patch does not fix the strict aliasing problem
itself, so there is a possibility that future GCC can generate
crashing binaries even if built by "-O0".

Behdad suggested to use the unions instead of tricky casts.
It would be something like:

diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 50a6189..8fb3387 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -283,11 +283,15 @@
   {
     FTC_Cache         cache = FTC_CACHE( cmap_cache );
     FTC_CMapQueryRec  query;
-    FTC_CMapNode      node;
     FT_Error          error;
     FT_UInt           gindex = 0;
     FT_UInt32         hash;
     FT_Int            no_cmap_change = 0;
+    union
+    {
+      FTC_Node      node;
+      FTC_CMapNode  cmap;
+    } ftc_unode;


     if ( cmap_index < 0 )
@@ -371,20 +375,20 @@

 #if 1
     FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
-                          node, error );
+                          ftc_unode.node, error );
 #else
-    error = FTC_Cache_Lookup( cache, hash, &query, (FTC_Node*) &node );
+    error = FTC_Cache_Lookup( cache, hash, &query, &(ftc_unode.node) );
 #endif
     if ( error )
       goto Exit;

-    FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
+    FT_ASSERT( (FT_UInt)( char_code - ftc_unode.cmap->first ) <
FTC_CMAP_INDICES_MAX );

     /* something rotten can happen with rogue clients */
-    if ( (FT_UInt)( char_code - node->first >= FTC_CMAP_INDICES_MAX ) )
+    if ( (FT_UInt)( char_code - ftc_unode.cmap->first >= FTC_CMAP_INDICES_MAX
) )
       return 0;

-    gindex = node->indices[char_code - node->first];
+    gindex = ftc_unode.cmap->indices[char_code - ftc_unode.cmap->first];
     if ( gindex == FTC_CMAP_UNKNOWN )
     {
       FT_Face  face;

I made a patch to modify all parts warned as violating strict aliasing
and uploaded a source rpm onto Redhat bugzilla.

(file #18780)

suzuki toshiya <mpsuzuki>
Group administrator
Fri 25 Sep 2009 06:12:24 AM UTC, comment #16: 

Thanks, I will report this issue to GCC team.
Before the discussion with GCC developers,
I proposed my third fix to Fedora Core developers.

suzuki toshiya <mpsuzuki>
Group administrator
Fri 25 Sep 2009 05:08:28 AM UTC, comment #15: 

Hmm.  This looks even more like a manifestation of a compiler bug.  I really hope that you get responses from the gcc team.

Werner LEMBERG <wl>
Group administrator
Thu 24 Sep 2009 05:47:13 PM UTC, comment #14: 

Maybe I found the third solution.

I was checking why FT2 crashes even if built by -O0,
when FTC_CACHE_LOOKUP_CMP() is separated as an
individual function.

I found that the initialization of node = NULL; can make
node optimized as a local constant and it can cause
inappropriate pointer at _pnode = (FTC_Node*)(void *)&(node);

#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
  FT_BEGIN_STMNT                                                         \
    FTC_Node             *_bucket, *_pnode, _node;                       \
    FTC_Cache             _cache   = FTC_CACHE(cache);                   \
    FT_UInt32             _hash    = (FT_UInt32)(hash);                  \
    FTC_Node_CompareFunc  _nodcomp = (FTC_Node_CompareFunc)(nodecmp);    \
    FT_UFast              _idx;                                          \
                                                                         \
                                                                         \
    error = 0;                                                           \
    node  = NULL;                                                        \ <-------------
    _idx  = _hash & _cache->mask;                                        \

[snip]

  _NewNode:                                                              \
    error = FTC_Cache_NewNode( _cache, _hash, query, &_node );           \
                                                                         \
  _Ok:                                                                   \
    _pnode = (FTC_Node*)(void*)&(node);                                  \ <--------
    *_pnode = _node;                                                     \
  FT_END_STMNT

In this cpp macro function, the value of node is never used
and always overwritten by _node. Therefore, skipping the
initialization should not have any impact. If I comment out
node = NULL, the binary built by GCC-4.4.1 with -O2 does
not crash.

(file #18767)

suzuki toshiya <mpsuzuki>
Group administrator
Mon 21 Sep 2009 06:28:09 PM UTC, comment #13: 

https://savannah.nongnu.org/bugs/download.php?file_id=18746
is a sample of A) that decrease the optimization flag replace
-O[2-9][0-9]* by -O, when GCC has an inline optimizer.
It compiles cache driver with FTC_COMPILE command which
uses FTC_CFLAGS instead of FT_CFLAGS.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 21 Sep 2009 06:26:41 PM UTC, comment #12: 
suzuki toshiya <mpsuzuki>
Group administrator
Mon 21 Sep 2009 06:46:43 AM UTC, comment #11: 

I will discuss in gcc list when I could minimize a sample
code that reproduces the problem. At present, my
investigation is insufficient to blame this issue as the
bug of GCC optimizer, because following 2 reasons:

1) If I separate the problematic cpp-macro function
as an individual C function, it always crashes even
if I build without optimization (-O0).

2) The changeset introduced in 2008-08-09 was designed
to ignore a pointer to function (not variable) during
inlining if the function is not required.

As a quick workaround before the further investigation,
I have 2 ideas:

A) Detect the problematic GCC by configure and disable
optimizer (or inlining itself) for cache driver.
In the changeset of 2008-08-09, short sample code
inline-2.c is provided. However, it is arguable if the inclusion
of inline-2.c forbids dual license of FreeType2.

B) To modify the value of pointer (update node with the
pointer _node allocated by FTC_Cache_NewNode()), use
ft_memcpy( a, b, sizeof(FT_Pointer) ) does not cause crash.

A) is not good for developers & other software project using
FreeType2 who does not execute configure. But B) is too ad-
hoc and ugly hack.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 21 Sep 2009 06:03:37 AM UTC, comment #10: 

Thanks for your hard work!  Are you going to discuss this problem on the gcc mailing list?  Maybe they can (a) decide whether it is a gcc bug and (b) provide a workaround.

Werner LEMBERG <wl>
Group administrator
Fri 18 Sep 2009 02:24:05 PM UTC, comment #9: 

Since following changes, GCC=4.4 branch start to generate
crashing binary. It might be designed to improve the function
inlining.

Date:   Sat Aug 9 17:28:39 2008 +0000

    2008-08-09  Richard Guenther  <rguenther@suse.de>
   
        * gimple.c (gimple_build_call_1): Deal with FUNCTION_DECL fn.
        * gimple.h (gimple_call_fn): Adjust comment.
        (gimple_call_set_fndecl): New function.
        (gimple_call_fndecl): Adjust for GIMPLE_CALL no
        longer having bare FUNCTION_DECL operand.
        (gimple_call_return_type): Likewise.
        * tree-cfg.c (verify_stmt): Verify function operand of a GIMPLE_CALL.
   
        * value-prof.c (gimple_divmod_fixed_value): Do not emit labels.
        (gimple_mod_pow2): Likewise.
        (gimple_mod_subtract): Likewise.
        (gimple_ic): Likewise.
        (gimple_stringop_fixed_value): Likewise.
        (gimple_indirect_call_to_profile): Fix for GIMPLE_CALL no
        longer having bare FUNCTION_DECL operand.
        * ipa-cp.c (ipcp_update_callgraph): Use gimple_call_set_fndecl.
        * omp-low.c (optimize_omp_library_calls): Likewise.
        * cgraphunit.c (update_call_expr): Likewise.
        * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
        (execute_convert_to_rsqrt): Likewise.
        * cfgexpand.c (gimple_to_tree): Simplify.
        (release_stmt_tree): Fix for GIMPLE_CALL no longer having
        bare FUNCTION_DECL operand.
        * tree-nested.c (init_tmp_var_with_call): Use gimple_call_return_type.
        (convert_gimple_call): Use gimple_call_fndecl.
        * c-common.c (c_warn_unused_result): Likewise.
   
        * gcc.dg/tree-ssa/inline-2.c: New testcase.

suzuki toshiya <mpsuzuki>
Group administrator
Thu 17 Sep 2009 04:54:01 AM UTC, comment #8: 

investigation of GCC-4.4 revision check continued
GCC-4.4 branch 2008-08-01 was not changed yet.
GCC-4.4 branch 2008-09-01 was already changed.
GCC-4.4 branch 2008-10-01 was already changed.

suzuki toshiya <mpsuzuki>
Group administrator
Wed 16 Sep 2009 04:40:59 PM UTC, comment #7: 

Also now I'm tracking the revision when GCC-4.4 branch
is changed to make the crashing binary.
GCC-4.4 branch 2008-02-19 was not changed yet.
GCC-4.4 branch 2008-07-01 was not changed yet.
GCC-4.4 branch 2009-01-01 was already changed yet.
GCC-4.4.0 was already changed.
Now I'm checking 2008-10-01...

suzuki toshiya <mpsuzuki>
Group administrator
Wed 16 Sep 2009 04:37:32 PM UTC, comment #6: 

https://savannah.nongnu.org/bugs/download.php?file_id=18723
is a patch to separate the crashing macro function
FTC_CACHE_LOOKUP_CMP() as an indivitual C function
ftc_cache_lookup_cmp().

If I apply this patch, libfreetype always crashes - by -O0, -O1,
-O2, and by GCC-4.3.4. I was thinking the crash problem is
caused by GCC optimizer's bug, but there is a possibility that
something wrong in the source code (if I have no mistake in
ftc_cache_lookup_cmp()).

ftc_cache_lookup_cmp() is a void function, but when I change it
to return a new node pointer (instead of rewriting callers "node"),
the crashing problem disappears. It can be related with the
valid scope of "node"...?

suzuki toshiya <mpsuzuki>
Group administrator
Mon 14 Sep 2009 09:41:54 PM UTC, comment #5: 

libfreetype built by gcc-4.3.4 (not prebuilt RPM,
I built from source, without patch) does not
make VTK sample crashed.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 14 Sep 2009 07:42:46 PM UTC, comment #4: 

Oops. It was already reported by the title in
RedHat bugzilla "unless -fno-strict-aliasing".
https://bugzilla.redhat.com/show_bug.cgi?id=506840
GCC "-O2" enables "-fstrict-aliasing".

suzuki toshiya <mpsuzuki>
Group administrator
Mon 14 Sep 2009 07:36:41 PM UTC, comment #3: 

Just I've built with "-O1",
still libfreetype does not make VTK sample crashed.
The libfreetype built with "-O2" makes VTK sample crashed.
GCC I'm using is gcc-4.4.1-2.fc11.
I will try other GCCs.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 14 Sep 2009 07:01:40 PM UTC, comment #2: 

Yes, I will try.
Just I've built FreeType2 with "-O0",
it does not make VTK sample crashed.
So I guess this can be an optimizer bug
of gcc.

suzuki toshiya <mpsuzuki>
Group administrator
Mon 14 Sep 2009 05:54:53 AM UTC, comment #1: 

Changing title and increasing importance...

I've already sent an email to David, asking for assistance to make FreeType compile again with C++ (see the comments in Redhat bug #513582), but I got no answer :-(

Maybe you, Toshiya-san, can provide a fix?

Werner LEMBERG <wl>
Group administrator
Mon 14 Sep 2009 01:10:55 AM UTC, original submission:  

Fedora Core adopted a patch to fix a crashing bug in cache:
https://bugzilla.redhat.com/show_bug.cgi?id=506840
https://bugzilla.redhat.com/show_bug.cgi?id=513582
The patch is applied to git main trunk, freetype-2.3.10 will include it.
However, by this patch,  FTC_CACHE_LOOKUP_CMP() macro is warned
as "assignment from incompatible pointer type".
In RedHat bugzilla, the problem was discussed but nobody improved
the patch.

Just I've setup FedoraCore 11 and freetype-2.3.9-3 could
reproduced the problem (by VTK sample code).

suzuki toshiya <mpsuzuki>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #18791:  mps-20090929a.patch added by mpsuzuki (12KiB - text/x-patch)
file #18780:  mps-20090926_union.patch added by mpsuzuki (12KiB - text/x-patch)
file #18767:  mps-fix-20090925c.patch added by mpsuzuki (2KiB - text/x-patch)
file #18723:  mps-debug_20090916b.patch added by mpsuzuki (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by wl
  • -email is unavailable- added by mpsuzuki (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-09-29 mpsuzuki Planned ReleaseNone 2.3.10
        StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2009-09-28 mpsuzuki Attached File- Added mps-20090929a.patch, #18791
    2009-09-26 mpsuzuki Attached File- Added mps-20090927_caller-cast.patch, #18781
    2009-09-26 mpsuzuki Attached File- Added mps-20090926_union.patch, #18780
    2009-09-24 mpsuzuki Attached File- Added mps-fix-20090925c.patch, #18767
    2009-09-21 mpsuzuki Attached File- Added decrease-gcc-inline-optimizer.patch, #18746
    2009-09-16 mpsuzuki Attached File- Added mps-debug_20090916b.patch, #18723
    2009-09-14 wl Carbon-Copy- Added freetype
        Severity2 - Minor 5 - Blocker
        StatusNeed Info Confirmed
        Summarybug #26849 makes &quot;assignment from incompatible pointer type&quot; Fix of bug #26849 makes C++ compilation fail

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code