Commit f096c02a by Ian Bolton Committed by Ramana Radhakrishnan

For Ian Bolton <ian.bolton@arm.com>

	* tree-switch-conversion.c (gen_inbound_check): Ensure that the
	type for the conditional has wide enough range.

	* testsuite/g++.dg/pr44328.C: New test.

From-SVN: r163366
parent d76799c7
2010-08-19 Ian Bolton <ian.bolton@arm.com>
* tree-switch-conversion.c (gen_inbound_check): Ensure that the
type for the conditional has wide enough range.
2010-08-18 Uros Bizjak <ubizjak@gmail.com> 2010-08-18 Uros Bizjak <ubizjak@gmail.com>
PR target/45327 PR target/45327
......
2010-08-19 Ian Bolton <ian.bolton@arm.com>
* g++.dg/pr44328.C: New test.
2010-08-19 Tobias Burnus <burnus@net-b.de> 2010-08-19 Tobias Burnus <burnus@net-b.de>
PR fortran/36158 PR fortran/36158
......
/* { dg-do compile } */
/* { dg-options "-c -O2 -Wextra" } */
#define O_RDONLY (1<<0)
#define O_WRONLY (1<<1)
#define O_RDWR (O_RDONLY|O_WRONLY)
#define O_CREAT (1<<3)
#define O_TRUNC (1<<6)
typedef enum {
OM_READ = 0,
OM_WRITE,
OM_READWRITE_NOCREATE,
OM_READWRITE_CREATE
} OpenMode;
extern int open(const char *name, int mode);
void open_file(const char *filename, const OpenMode rw)
{
int mode = 0;
switch( rw )
{
case OM_WRITE:
mode = O_WRONLY|O_CREAT|O_TRUNC;
break;
case OM_READ:
mode = O_RDONLY;
break;
case OM_READWRITE_NOCREATE:
mode = O_RDWR;
break;
case OM_READWRITE_CREATE:
mode = O_RDWR|O_CREAT|O_TRUNC;
break;
}
open( filename, mode );
}
...@@ -96,6 +96,7 @@ eight) times the number of the actual switch branches. */ ...@@ -96,6 +96,7 @@ eight) times the number of the actual switch branches. */
#include "gimple-pretty-print.h" #include "gimple-pretty-print.h"
#include "tree-dump.h" #include "tree-dump.h"
#include "timevar.h" #include "timevar.h"
#include "langhooks.h"
/* The main structure of the pass. */ /* The main structure of the pass. */
struct switch_conv_info struct switch_conv_info
...@@ -694,9 +695,11 @@ gen_inbound_check (gimple swtch) ...@@ -694,9 +695,11 @@ gen_inbound_check (gimple swtch)
/* Make sure we do not generate arithmetics in a subrange. */ /* Make sure we do not generate arithmetics in a subrange. */
if (TREE_TYPE (TREE_TYPE (info.index_expr))) if (TREE_TYPE (TREE_TYPE (info.index_expr)))
utype = unsigned_type_for (TREE_TYPE (TREE_TYPE (info.index_expr))); utype = lang_hooks.types.type_for_mode
(TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1);
else else
utype = unsigned_type_for (TREE_TYPE (info.index_expr)); utype = lang_hooks.types.type_for_mode
(TYPE_MODE (TREE_TYPE (info.index_expr)), 1);
/* (end of) block 0 */ /* (end of) block 0 */
gsi = gsi_for_stmt (info.arr_ref_first); gsi = gsi_for_stmt (info.arr_ref_first);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment