+2008-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36507
+ * c-decl.c (merge_decls): Don't clear DECL_EXTERNAL for
+ nested inline functions.
+ (start_decl, start_function): Don't invert DECL_EXTERNAL
+ for nested inline functions.
+
2008-06-13 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.md: Remove TARGET_DEBUG_D_MODE conditions from
|| !DECL_DECLARED_INLINE_P (olddecl)
|| !DECL_EXTERNAL (olddecl))
&& DECL_EXTERNAL (newdecl)
- && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)))
+ && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))
+ && (DECL_CONTEXT (newdecl) == NULL_TREE
+ || TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL))
DECL_EXTERNAL (newdecl) = 0;
if (DECL_EXTERNAL (newdecl))
if (declspecs->inline_p
&& !flag_gnu89_inline
&& TREE_CODE (decl) == FUNCTION_DECL
- && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl)))
+ && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))
+ || current_function_decl))
{
if (declspecs->storage_class == csc_auto && current_scope != file_scope)
;
if (declspecs->inline_p
&& !flag_gnu89_inline
&& TREE_CODE (decl1) == FUNCTION_DECL
- && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1)))
+ && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1))
+ || current_function_decl))
{
if (declspecs->storage_class != csc_static)
DECL_EXTERNAL (decl1) = !DECL_EXTERNAL (decl1);
+2008-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36507
+ * gcc.dg/inline-28.c: New test.
+ * gcc.dg/inline-29.c: New test.
+ * gcc.dg/inline-30.c: New test.
+
2008-06-12 Tobias Burnus <burnus@net-b.de>
PR fortran/36462
--- /dev/null
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu89" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}
--- /dev/null
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu99" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}
--- /dev/null
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu99 -fgnu89-inline" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}