aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-03-27 13:46:16 +0000
committerJakub Jelinek <jakub@redhat.com>2007-03-27 13:46:16 +0000
commitf62ed8167cad868de38d2d88e8aa7b8379e10dea (patch)
tree04042bdfe856e9e048bbd39da41db088bf0f1969
parent3e6fcd842543d78bc3598eee5e83fa4dbb1eca37 (diff)
svn merge -r123011:123245 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch@123257 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog38
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/c-common.c27
-rw-r--r--gcc/c-cppbuiltin.c2
-rw-r--r--gcc/c-opts.c6
-rw-r--r--gcc/c.opt4
-rw-r--r--gcc/config/i386/emmintrin.h8
-rw-r--r--gcc/config/i386/mmintrin.h7
-rw-r--r--gcc/config/i386/xmmintrin.h7
-rw-r--r--gcc/doc/cpp.texi22
-rw-r--r--gcc/doc/extend.texi65
-rw-r--r--gcc/doc/invoke.texi25
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/invoke.texi2
-rw-r--r--gcc/testsuite/ChangeLog18
-rw-r--r--gcc/testsuite/g++.dg/opt/pr30590.C40
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr30984.c7
-rw-r--r--gcc/testsuite/gcc.dg/inline-17.c24
-rw-r--r--gcc/testsuite/gcc.dg/inline-18.c28
-rw-r--r--gcc/testsuite/gcc.dg/inline-19.c28
-rw-r--r--gcc/testsuite/gcc.dg/inline-21.c4
-rw-r--r--gcc/testsuite/gcc.dg/inline-7.c2
-rw-r--r--gcc/tree-cfg.c13
-rw-r--r--gcc/tree-nrv.c8
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/io/unix.c6
26 files changed, 379 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c7c6648ddc4..cacbcbce7b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,41 @@
+2007-03-21 Richard Henderson <rth@redhat.com>
+
+ PR target/31245
+ * config/i386/emmintrin.h (__m128i, __m128d): Mark may_alias.
+ * config/i386/mmintrin.h (__m64): Likewise.
+ * config/i386/xmmintrin.h (__m128): Likewise.
+
+2007-03-19 Seongbae Park <seongbae.park@gmail.com>
+
+ PR tree-optimization/30590
+ * tree-nrv.c (tree_nrv): Check for the partial update
+ of the return value.
+
+2007-03-19 Jeff Law <law@redhat.com>
+
+ * tree-cfg.c (find_taken_edge): Tighten conditions for
+ optimizing computed gotos.
+
+2007-03-19 Brooks Moses <brooks.moses@codesourcery.com>
+
+ * doc/extend.texi: Edit "gnu_inline" documentation.
+ * doc/invoke.texi: Edit "-fgnu89-inline" documentation.
+
+2007-03-19 Ian Lance Taylor <iant@google.com>
+
+ * c.opt (fgnu89-inline): New option.
+ * c-opts.c (c_common_post_options): Warn about -fno-gnu89-inline.
+ * c-common.c (c_common_attributes): Add gnu_inline attribyte.
+ (handle_gnu_inline_attribute): New static function.
+ * c-cppbuiltin.c (c_cpp_builtins): Define __GNUC_GNU_INLINE__.
+ * doc/invoke.texi (Option Summary): Mention -fgnu89-inline.
+ (C Dialect Options): Document -fgnu89-inline.
+ * doc/extend.texi (Function Attributes): Document gnu_inline.
+ (Inline): Mention that C99 inline will be implemented in 4.3.
+ Refer to ways to get the old handling.
+ * doc/cpp.texi (Common Predefined Macros): Document
+ __GNUC_GNU_INLINE__ and __GNUC_STDC_INLINE__.
+
2007-03-17 Alexandre Oliva <aoliva@redhat.com>
PR debug/29906
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index f1ee387cccb..47f1875214a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20070317
+20070327
diff --git a/gcc/c-common.c b/gcc/c-common.c
index d624f72d370..237e36c240e 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -505,6 +505,8 @@ static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree handle_always_inline_attribute (tree *, tree, tree, int,
bool *);
+static tree handle_gnu_inline_attribute (tree *, tree, tree, int,
+ bool *);
static tree handle_flatten_attribute (tree *, tree, tree, int, bool *);
static tree handle_used_attribute (tree *, tree, tree, int, bool *);
static tree handle_unused_attribute (tree *, tree, tree, int, bool *);
@@ -573,6 +575,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_noinline_attribute },
{ "always_inline", 0, 0, true, false, false,
handle_always_inline_attribute },
+ { "gnu_inline", 0, 0, true, false, false,
+ handle_gnu_inline_attribute },
{ "flatten", 0, 0, true, false, false,
handle_flatten_attribute },
{ "used", 0, 0, true, false, false,
@@ -4153,6 +4157,29 @@ handle_always_inline_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* Handle a "gnu_inline" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_gnu_inline_attribute (tree *node, tree name,
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags),
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (*node))
+ {
+ /* Do nothing else, just set the attribute. We'll get at
+ it later with lookup_attribute. */
+ }
+ else
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "flatten" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index f07e4fb04ee..270f279bbe3 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -393,6 +393,8 @@ c_cpp_builtins (cpp_reader *pfile)
/* Misc. */
builtin_define_with_value ("__VERSION__", version_string, 1);
+ cpp_define (pfile, "__GNUC_GNU_INLINE__");
+
/* Definitions for LP64 model. */
if (TYPE_PRECISION (long_integer_type_node) == 64
&& POINTER_SIZE == 64
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 551893f0c1f..4f5f734a59f 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -990,6 +990,12 @@ c_common_post_options (const char **pfilename)
if (flag_inline_functions)
flag_inline_trees = 2;
+ /* We recognize -fgnu89-inline in preparation for 4.3 where the
+ option will be meaningful. Here we just reject
+ -fno-gnu89-inline, since we don't support it. */
+ if (!flag_gnu89_inline)
+ error ("-fno-gnu89-inline is not supported");
+
/* If we are given more than one input file, we must use
unit-at-a-time mode. */
if (num_in_fnames > 1)
diff --git a/gcc/c.opt b/gcc/c.opt
index 80b13764da4..d0149917a02 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -532,6 +532,10 @@ fgnu-runtime
ObjC ObjC++
Generate code for GNU runtime environment
+fgnu89-inline
+C Var(flag_gnu89_inline) Init(-1)
+Use traditional GNU semantics for inline functions
+
fguiding-decls
C++ ObjC++
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index 0b63163ebe9..76df7c984ce 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -40,8 +40,10 @@ typedef int __v4si __attribute__ ((__vector_size__ (16)));
typedef short __v8hi __attribute__ ((__vector_size__ (16)));
typedef char __v16qi __attribute__ ((__vector_size__ (16)));
-typedef __v2di __m128i;
-typedef __v2df __m128d;
+/* The Intel API is flexible enough that we must allow aliasing with other
+ vector types, and their scalar components. */
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
/* Create a selector for use with the SHUFPD instruction. */
#define _MM_SHUFFLE2(fp1,fp0) \
diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
index df0df44ee1b..feb301a04ba 100644
--- a/gcc/config/i386/mmintrin.h
+++ b/gcc/config/i386/mmintrin.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -33,8 +33,9 @@
#ifndef __MMX__
# error "MMX instruction set not enabled"
#else
-/* The data type intended for user use. */
-typedef int __m64 __attribute__ ((__vector_size__ (8)));
+/* The Intel API is flexible enough that we must allow aliasing with other
+ vector types, and their scalar components. */
+typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
/* Internal data types for implementing the intrinsics. */
typedef int __v2si __attribute__ ((__vector_size__ (8)));
diff --git a/gcc/config/i386/xmmintrin.h b/gcc/config/i386/xmmintrin.h
index 23eb5de2838..3b623f0d7b0 100644
--- a/gcc/config/i386/xmmintrin.h
+++ b/gcc/config/i386/xmmintrin.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -40,8 +40,9 @@
/* Get _mm_malloc () and _mm_free (). */
#include <mm_malloc.h>
-/* The data type intended for user use. */
-typedef float __m128 __attribute__ ((__vector_size__ (16)));
+/* The Intel API is flexible enough that we must allow aliasing with other
+ vector types, and their scalar components. */
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
/* Internal data types for implementing the intrinsics. */
typedef float __v4sf __attribute__ ((__vector_size__ (16)));
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 671ed1430da..a4ddec8f5e2 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -2019,6 +2019,28 @@ functions. You should not use these macros in any way unless you make
sure that programs will execute with the same effect whether or not they
are defined. If they are defined, their value is 1.
+@item __GNUC_GNU_INLINE__
+GCC defines this macro if functions declared @code{inline} will be
+handled in GCC's traditional gnu89 mode. In this mode an @code{extern
+inline} function will never be compiled as a standalone function, and
+an @code{inline} function which is neither @code{extern} nor
+@code{static} will always be compiled as a standalone function.
+
+@item __GNUC_STDC_INLINE__
+GCC defines this macro if functions declared @code{inline} will be
+handled according to the ISO C99 standard. In this mode an
+@code{extern inline} function will always be compiled as a standalone
+externally visible function, and an @code{inline} function which is
+neither @code{extern} nor @code{static} will never be compiled as a
+standalone function.
+
+If this macro is defined, GCC supports the @code{gnu_inline} function
+attribute as a way to always get the gnu89 behaviour. Support for
+this and @code{__GNUC_GNU_INLINE__} was added in GCC 4.1.3. If
+neither macro is defined, an older version of GCC is being used:
+@code{inline} functions will be compiled in gnu89 mode, and the
+@code{gnu_inline} function attribute will not be recognized.
+
@item __CHAR_UNSIGNED__
GCC defines this macro if and only if the data type @code{char} is
unsigned on the target machine. It exists to cause the standard header
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 2255cd60d5b..7376185d14e 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1527,8 +1527,8 @@ attributes are currently defined for functions on all targets:
@code{format}, @code{format_arg}, @code{no_instrument_function},
@code{section}, @code{constructor}, @code{destructor}, @code{used},
@code{unused}, @code{deprecated}, @code{weak}, @code{malloc},
-@code{alias}, @code{warn_unused_result}, @code{nonnull}
-and @code{externally_visible}. Several other
+@code{alias}, @code{warn_unused_result}, @code{nonnull},
+@code{gnu_inline} and @code{externally_visible}. Several other
attributes are defined for functions on particular target systems. Other
attributes, including @code{section} are supported for variables declarations
(@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}).
@@ -1566,6 +1566,46 @@ Generally, functions are not inlined unless optimization is specified.
For functions declared inline, this attribute inlines the function even
if no optimization level was specified.
+@item gnu_inline
+@cindex @code{gnu_inline} function attribute
+This attribute should be used with a function which is also declared
+with the @code{inline} keyword. It directs GCC to treat the function
+as if it were defined in gnu89 mode even when compiling in C99 or
+gnu99 mode.
+
+If the function is declared @code{extern}, then this definition of the
+function is used only for inlining. In no case is the function
+compiled as a standalone function, not even if you take its address
+explicitly. Such an address becomes an external reference, as if you
+had only declared the function, and had not defined it. This has
+almost the effect of a macro. The way to use this is to put a
+function definition in a header file with this attribute, and put
+another copy of the function, without @code{extern}, in a library
+file. The definition in the header file will cause most calls to the
+function to be inlined. If any uses of the function remain, they will
+refer to the single copy in the library. Note that the two
+definitions of the functions need not be precisely the same, although
+if they do not have the same effect your program may behave oddly.
+
+If the function is neither @code{extern} nor @code{static}, then the
+function is compiled as a standalone function, as well as being
+inlined where possible.
+
+This is how GCC traditionally handled functions declared
+@code{inline}. Since ISO C99 specifies a different semantics for
+@code{inline}, this function attribute is provided as a transition
+measure and as a useful feature in its own right. This attribute is
+available in GCC 4.1.3 and later. It is available if either of the
+preprocessor macros @code{__GNUC_GNU_INLINE__} or
+@code{__GNUC_STDC_INLINE__} are defined. @xref{Inline,,An Inline
+Function is As Fast As a Macro}.
+
+Note that since the first version of GCC to support C99 inline semantics
+is 4.3, earlier versions of GCC which accept this attribute effectively
+assume that it is always present, whether or not it is given explicitly.
+In versions prior to 4.3, the only effect of explicitly including it is
+to disable warnings about using inline functions in C99 mode.
+
@cindex @code{flatten} function attribute
@item flatten
Generally, inlining into a function is limited. For a function marked with
@@ -3543,7 +3583,15 @@ you don't use @option{-O}, no function is really inline.
Inline functions are included in the ISO C99 standard, but there are
currently substantial differences between what GCC implements and what
-the ISO C99 standard requires.
+the ISO C99 standard requires. GCC will fully support C99 inline
+functions in version 4.3. The traditional GCC handling of inline
+functions will still be available with @option{-std=gnu89},
+@option{-fgnu89-inline} or when @code{gnu_inline} attribute is present
+on all inline declarations. The preprocessor macros
+@code{__GNUC_GNU_INLINE__} and @code{__GNUC_STDC_INLINE__} may be used
+to determine the handling of @code{inline} during a particular
+compilation (@pxref{Common Predefined Macros,,,cpp.info,The C
+Preprocessor}).
To declare a function inline, use the @code{inline} keyword in its
declaration, like this:
@@ -3619,12 +3667,15 @@ The definition in the header file will cause most calls to the function
to be inlined. If any uses of the function remain, they will refer to
the single copy in the library.
-Since GCC eventually will implement ISO C99 semantics for
-inline functions, it is best to use @code{static inline} only
+Since GCC 4.3 will implement ISO C99 semantics for
+inline functions, it is simplest to use @code{static inline} only
to guarantee compatibility. (The
existing semantics will remain available when @option{-std=gnu89} is
-specified, but eventually the default will be @option{-std=gnu99} and
-that will implement the C99 semantics, though it does not do so yet.)
+specified, but eventually the default will be @option{-std=gnu99};
+that will implement the C99 semantics, though it does not do so in
+versions of GCC before 4.3. After the default changes, the existing
+semantics will still be available via the @option{-fgnu89-inline}
+option or the @code{gnu_inline} function attribute.)
GCC does not inline any functions when not optimizing unless you specify
the @samp{always_inline} attribute for the function, like this:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 98e461eb26e..e47aeda0047 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -160,7 +160,8 @@ in the following sections.
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
-@gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol
+@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
+-aux-info @var{filename} @gol
-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fms-extensions @gol
-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
@@ -1187,6 +1188,28 @@ the @code{inline} keyword in ISO C99) are not disabled.
@xref{Standards,,Language Standards Supported by GCC}, for details of
these standard versions.
+@item -fgnu89-inline
+@opindex fgnu89-inline
+The option @option{-fgnu89-inline} tells GCC to use the traditional
+GNU semantics for @code{inline} functions when in C99 mode.
+@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this
+option is roughly equivalent to adding the @code{gnu_inline} function
+attribute to all inline functions (@pxref{Function Attributes}).
+
+This option is accepted by GCC versions 4.1.3 and up. In GCC versions
+prior to 4.3, C99 inline semantics are not supported, and thus this
+option is effectively assumed to be present regardless of whether or not
+it is specified; the only effect of specifying it explicitly is to
+disable warnings about using inline functions in C99 mode. Likewise,
+the option @option{-fno-gnu89-inline} is not supported in versions of
+GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in
+C89 or gnu89 mode.
+
+The preprocesor macros @code{__GNUC_GNU_INLINE__} and
+@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
+in effect for @code{inline} functions. @xref{Common Predefined
+Macros,,,cpp,The C Preprocessor}.
+
@item -aux-info @var{filename}
@opindex aux-info
Output to the given filename prototyped declarations for all functions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0d52cbad51b..8a5d6ad474e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-17 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/31184
+ * invoke.texi: Fix typo.
+
2007-03-14 Jakub Jelinek <jakub@redhat.com>
* module.c (mio_typespec): Don't look at ts->cl if not BT_CHARACTER.
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 050587c34d1..ab04dfc226c 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -196,7 +196,7 @@ older Fortran programs.
@cindex option, -fd-lines-as-comments
@cindex -fd-lines-as-comments, option
@item -fd-lines-as-code
-@item -fd-lines-as-comment
+@item -fd-lines-as-comments
Enables special treating for lines with @samp{d} or @samp{D} in fixed
form sources. If the @option{-fd-lines-as-code} option is given
they are treated as if the first column contained a blank. If the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc13da49a5b..fe447f71401 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2007-03-20 Seongbae Park <seongbae.park@gmail.com>
+
+ PR tree-optimization/30590
+ * g++.dg/opt/pr30590.C: New testcase.
+
+2007-03-19 Jeff Law <law@redhat.com>
+
+ * PR tree-optimization/30984
+ * gcc.c-torture/pr30984.c: New test.
+
+2007-03-19 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/inline-7.c: Add -fgnu89-inline.
+ * gcc.dg/inline-17.c: New test.
+ * gcc.dg/inline-18.c: New test.
+ * gcc.dg/inline-19.c: New test.
+ * gcc.dg/inline-21.c: New test.
+
2007-03-17 Alexandre Oliva <aoliva@redhat.com>
PR debug/29906
diff --git a/gcc/testsuite/g++.dg/opt/pr30590.C b/gcc/testsuite/g++.dg/opt/pr30590.C
new file mode 100644
index 00000000000..42ae046db81
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr30590.C
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+struct test
+{
+ int type;
+ char buffer[4242]; /* should trigger pass-by-reference */
+};
+
+int flag = 0;
+
+struct test
+reset (void)
+{
+ struct test retval;
+ retval.type = 1;
+ return retval;
+}
+
+struct test
+test (void)
+{
+ struct test result;
+ result.type = 0;
+
+ for (int i = 0; i < 2; ++i)
+ {
+ struct test candidate = reset ();
+ if (flag)
+ result = candidate;
+ }
+
+ return result;
+}
+
+int
+main (void)
+{
+ struct test result = test ();
+ return result.type;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30984.c b/gcc/testsuite/gcc.c-torture/compile/pr30984.c
new file mode 100644
index 00000000000..265a6f3616b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr30984.c
@@ -0,0 +1,7 @@
+int fs_exec(int ino)
+{
+ void *src = 0;
+ if (ino)
+ src = (void*)0xe000;
+ goto *src;
+}
diff --git a/gcc/testsuite/gcc.dg/inline-17.c b/gcc/testsuite/gcc.dg/inline-17.c
new file mode 100644
index 00000000000..235ad8b001e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-17.c
@@ -0,0 +1,24 @@
+/* Test __attribute__((gnu_inline)). */
+/* { dg-do compile } */
+/* { dg-options "-std=c99" } */
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler-not "func2" } } */
+/* { dg-final { scan-assembler "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+
+#if __STDC_VERSION__ >= 199901L
+# define inline __attribute__((gnu_inline)) inline
+#endif
+
+extern inline int func1 (void) { return 0; }
+inline int func1 (void) { return 1; }
+
+extern int func2 (void);
+extern inline int func2 (void) { return 2; }
+
+inline int func3 (void);
+inline int func3 (void) { return 3; }
+
+extern int func4 (void);
+extern inline int func4 (void) { return 4; }
+int func4 (void) { return 5; }
diff --git a/gcc/testsuite/gcc.dg/inline-18.c b/gcc/testsuite/gcc.dg/inline-18.c
new file mode 100644
index 00000000000..5a37195be94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-18.c
@@ -0,0 +1,28 @@
+/* Test -fgnu89-extern-inline. */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -fgnu89-inline" } */
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler-not "func2" } } */
+/* { dg-final { scan-assembler "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+
+#ifndef __GNUC_GNU_INLINE__
+#error __GNUC_GNU_INLINE__ is not defined
+#endif
+
+#ifdef __GNUC_STDC_INLINE__
+#error __GNUC_STDC_INLINE__ is defined
+#endif
+
+extern inline int func1 (void) { return 0; }
+inline int func1 (void) { return 1; }
+
+extern int func2 (void);
+extern inline int func2 (void) { return 2; }
+
+inline int func3 (void);
+inline int func3 (void) { return 3; }
+
+extern int func4 (void);
+extern inline int func4 (void) { return 4; }
+int func4 (void) { return 5; }
diff --git a/gcc/testsuite/gcc.dg/inline-19.c b/gcc/testsuite/gcc.dg/inline-19.c
new file mode 100644
index 00000000000..96dceb43356
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-19.c
@@ -0,0 +1,28 @@
+/* Test -fgnu89-extern-inline. */
+/* { dg-do compile } */
+/* { dg-options "-fgnu89-inline" } */
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler-not "func2" } } */
+/* { dg-final { scan-assembler "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+
+#ifndef __GNUC_GNU_INLINE__
+#error __GNUC_GNU_INLINE__ is not defined
+#endif
+
+#ifdef __GNUC_STDC_INLINE__
+#error __GNUC_STDC_INLINE__ is defined
+#endif
+
+extern inline int func1 (void) { return 0; }
+inline int func1 (void) { return 1; }
+
+extern int func2 (void);
+extern inline int func2 (void) { return 2; }
+
+inline int func3 (void);
+inline int func3 (void) { return 3; }
+
+extern int func4 (void);
+extern inline int func4 (void) { return 4; }
+int func4 (void) { return 5; }
diff --git a/gcc/testsuite/gcc.dg/inline-21.c b/gcc/testsuite/gcc.dg/inline-21.c
new file mode 100644
index 00000000000..8961ce493a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-21.c
@@ -0,0 +1,4 @@
+/* Test -fno-gnu89-inline. */
+/* { dg-do compile } */
+/* { dg-options "-fno-gnu89-inline" } */
+/* { dg-error "is not supported" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/inline-7.c b/gcc/testsuite/gcc.dg/inline-7.c
index b239a20461c..508aaa4bf99 100644
--- a/gcc/testsuite/gcc.dg/inline-7.c
+++ b/gcc/testsuite/gcc.dg/inline-7.c
@@ -1,6 +1,6 @@
/* Test duplicate inline, gnu99 mode. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
+/* { dg-options "-std=gnu99 -fgnu89-inline" } */
inline inline void f (void) {}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c75f68b908d..d0b0d87d31d 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2118,7 +2118,18 @@ find_taken_edge (basic_block bb, tree val)
return find_taken_edge_switch_expr (bb, val);
if (computed_goto_p (stmt))
- return find_taken_edge_computed_goto (bb, TREE_OPERAND( val, 0));
+ {
+ /* Only optimize if the argument is a label, if the argument is
+ not a label then we can not construct a proper CFG.
+
+ It may be the case that we only need to allow the LABEL_REF to
+ appear inside an ADDR_EXPR, but we also allow the LABEL_REF to
+ appear inside a LABEL_EXPR just to be safe. */
+ if ((TREE_CODE (val) == ADDR_EXPR || TREE_CODE (val) == LABEL_EXPR)
+ && TREE_CODE (TREE_OPERAND (val, 0)) == LABEL_DECL)
+ return find_taken_edge_computed_goto (bb, TREE_OPERAND (val, 0));
+ return NULL;
+ }
gcc_unreachable ();
}
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 761e6a0ab46..792e6ed991a 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -163,6 +163,14 @@ tree_nrv (void)
result_type))
return;
}
+ else if (TREE_CODE (stmt) == MODIFY_EXPR)
+ {
+ tree addr = get_base_address (TREE_OPERAND (stmt, 0));
+ /* If there's any MODIFY of component of RESULT,
+ then bail out. */
+ if (addr && addr == result)
+ return;
+ }
}
}
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 15cd28b3a6e..efcc1185a78 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-14 Jakub Jelinek <jakub@redhat.com>
+
+ * io/unix.c (regular_file): For ACTION_UNSPECIFIED retry with
+ O_RDONLY even if errno is EROFS.
+
2007-02-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/30918
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 560047f88f8..4d67e07f8f5 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1169,7 +1169,7 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
break;
case STATUS_REPLACE:
- crflag = O_CREAT | O_TRUNC;
+ crflag = O_CREAT | O_TRUNC;
break;
default:
@@ -1185,14 +1185,14 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
fd = open (path, rwflag | crflag, mode);
if (flags->action != ACTION_UNSPECIFIED)
- return fd;
+ return fd;
if (fd >= 0)
{
flags->action = ACTION_READWRITE;
return fd;
}
- if (errno != EACCES)
+ if (errno != EACCES && errno != EROFS)
return fd;
/* retry for read-only access */