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 middle-end/16558] [4.0 Regression]: bogus missing-return warning


------- Additional Comments From dpatel at apple dot com  2004-10-06 21:00 -------
In gimple-low.c, we have

     88   /* If the function falls off the end, we need a null return statement.
     89      If we've already got one in the return_statements list, we don't
     90      need to do anything special.  Otherwise build one by hand.  */
     91   if (block_may_fallthru (*body_p)
     92       && (data.return_statements == NULL
     93           || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
     94     {
     95       x = build (RETURN_EXPR, void_type_node, NULL);
     96       SET_EXPR_LOCATION (x, cfun->function_end_locus);
     97       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     98     }

And in tree-cfg.c, we have

   5310       FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
   5311         {
   5312           tree last = last_stmt (e->src);
   5313           if (TREE_CODE (last) == RETURN_EXPR
   5314               && TREE_OPERAND (last, 0) == NULL)
   5315             {
   5316 #ifdef USE_MAPPED_LOCATION
   5317               location = EXPR_LOCATION (last);
   5318               if (location == UNKNOWN_LOCATION)
   5319                   location = cfun->function_end_locus;
   5320               warning ("%Hcontrol reaches end of non-void function", &location);
   5321 #else
   5322               locus = EXPR_LOCUS (last);
   5323               if (!locus)
   5324                 locus = &cfun->function_end_locus;
   5325               warning ("%Hcontrol reaches end of non-void function", locus);
   5326 #endif
   5327               break;
   5328             }
   5329         }


These two code fragements need to talk with each other.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16558


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