Skip to content

Commit

Permalink
Rewrite the "choose_random" functions with Vector Filter
Browse files Browse the repository at this point in the history
Using vector filter to rewrite the choose_random method in Type.cpp.
And modifed the function name with "PointerType::" or "AggregationType::"
Signed-off-by: ZhuJunhua1104 tom.Zhu@huawei.com
  • Loading branch information
ZhuJunhua1104 committed Jul 29, 2015
1 parent 7595614 commit 37e9dd4
Show file tree
Hide file tree
Showing 14 changed files with 285 additions and 1,313 deletions.
11 changes: 7 additions & 4 deletions src/Bookkeeper.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2010, 2011, 2013 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -278,7 +281,7 @@ Bookkeeper::output_pointer_statistics(std::ostream &out)
total_has_null_ptr++;
}
const Variable* var = ptrs[i];
const Type* t = var->type;
const PointerType * t = dynamic_cast<const PointerType *>(var->type);
assert(t->eType == ePointer);
if (t->get_indirect_level() > 1) {
point_to_pointer++;
Expand Down Expand Up @@ -487,10 +490,10 @@ Bookkeeper::record_vars_with_bitfields(const Type *type)
}

void
Bookkeeper::record_type_with_bitfields(const Type *typ)
Bookkeeper::record_type_with_bitfields(const Type *type)
{
if (!typ->is_aggregate()) return;

if (!type->is_aggregate()) return;
const AggregateType * typ = dynamic_cast<const AggregateType *>(type);
if (typ->has_bitfields()) {
Bookkeeper::structs_with_bitfields++;
size_t len = typ->bitfields_length_.size();
Expand Down
8 changes: 6 additions & 2 deletions src/CVQualifiers.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -31,6 +34,7 @@
#include <iostream>
#include "CVQualifiers.h"
#include "Type.h"
#include "PointerType.h"
#include "Effect.h"
#include "CGContext.h"
#include "CGOptions.h"
Expand Down Expand Up @@ -290,7 +294,7 @@ CVQualifiers::random_qualifiers(const Type* t, Effect::Access access, const CGCo
const Effect &effect_context = cg_context.get_effect_context();

// set random volatile/const properties for each level of indirection for pointers
const Type* tmp = t->ptr_type;
const Type* tmp = (t->eType == ePointer) ? (dynamic_cast<const PointerType *>(t))->ptr_type : NULL;
while (tmp) {
isVolatile = rnd_flipcoin(volatile_prob);
isConst = rnd_flipcoin(const_prob);
Expand All @@ -299,7 +303,7 @@ CVQualifiers::random_qualifiers(const Type* t, Effect::Access access, const CGCo
}
is_consts.push_back(isConst);
is_volatiles.push_back(isVolatile);
tmp = tmp->ptr_type;
tmp = (tmp->eType == ePointer) ? (dynamic_cast<const PointerType *>(tmp))->ptr_type : NULL;
}
// set random volatile/const properties for variable itself
bool volatile_ok = effect_context.is_side_effect_free();
Expand Down
14 changes: 10 additions & 4 deletions src/Constant.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013, 2014 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -241,11 +244,12 @@ GenerateRandomConstantInRange(const Type* type, int bound)
* "{2, 4, {2, 4}, 6.0}"
*************************************************************/
static string
GenerateRandomStructConstant(const Type* type)
GenerateRandomStructConstant(const Type* t)
{
string value = "{";
size_t i;
assert(type->eType == eStruct);
assert(t->eType == eStruct);
const AggregateType * type = dynamic_cast<const AggregateType *>(t);
assert(type->fields.size() == type->bitfields_length_.size());

for (i = 0; i < type->fields.size(); i++) {
Expand Down Expand Up @@ -277,10 +281,12 @@ GenerateRandomStructConstant(const Type* type)
the first field is enough
*************************************************************/
static string
GenerateRandomUnionConstant(const Type* type)
GenerateRandomUnionConstant(const Type* t)
{
string value = "{";
assert(type->eType == eUnion && type->fields.size() == type->bitfields_length_.size());
assert (t->eType == eUnion);
const AggregateType * type = dynamic_cast<const AggregateType *>(t);
assert(type->fields.size() == type->bitfields_length_.size());
value += GenerateRandomConstant(type->fields[0]);
value += "}";
return value;
Expand Down
6 changes: 5 additions & 1 deletion src/FactUnion.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2009, 2010, 2011 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -32,6 +35,7 @@
#include "CGOptions.h"
#include "Fact.h"
#include "Type.h"
#include "AggregateType.h"
#include "Common.h"
#include "Function.h"
#include "FactMgr.h"
Expand Down Expand Up @@ -289,7 +293,7 @@ FactUnion::imply(const Fact& f) const
bool
FactUnion::is_field_readable(const Variable* v, int fid, const vector<const Fact*>& facts)
{
assert(v->type->eType == eUnion && fid >=0 && fid < (int)(v->type->fields.size()));
assert(v->type->eType == eUnion && fid >=0 && fid < (int)((dynamic_cast<const AggregateType *>(v->type))->fields.size()));
FactUnion tmp(v, fid);
const FactUnion* fu = dynamic_cast<const FactUnion*>(find_related_fact(facts, &tmp));
return (fu && tmp.imply(*fu)) ;
Expand Down
5 changes: 4 additions & 1 deletion src/Function.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2010, 2011, 2013, 2014 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -575,7 +578,7 @@ Function::GenerateBody(const CGContext &prev_context)
cg_context.extend_call_chain(prev_context);
FactMgr* fm = get_fact_mgr_for_func(this);
for (size_t i=0; i<params.size(); i++) {
if (params[i]->type->ptr_type != 0) {
if (params[i]->type->eType == ePointer) {
fm->global_facts.push_back(FactPointTo::make_fact(params[i], FactPointTo::tbd_ptr));
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/FunctionInvocation.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013, 2014 The University of Utah
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -160,7 +163,7 @@ FunctionInvocation::make_random_unary(CGContext &cg_context, const Type* type)
FunctionInvocation *
FunctionInvocation::make_random_binary(CGContext &cg_context, const Type* type)
{
if (rnd_flipcoin(10) && Type::has_pointer_type()) {
if (rnd_flipcoin(10) && PointerType::has_pointer_type()) {
return make_random_binary_ptr_comparison(cg_context);
}

Expand Down Expand Up @@ -270,7 +273,7 @@ FunctionInvocation::make_random_binary_ptr_comparison(CGContext &cg_context)
SafeOpFlags *flags = SafeOpFlags::make_random_binary(get_int_type(), NULL, NULL, sOpBinary, op);

FunctionInvocation *fi = FunctionInvocationBinary::CreateFunctionInvocationBinary(cg_context, op, flags);
const Type* type = Type::choose_random_pointer_type();
const Type* type = PointerType::choose_random_pointer_type();

Effect lhs_eff_accum;
CGContext lhs_cg_context(cg_context, cg_context.get_effect_context(), &lhs_eff_accum);
Expand Down
55 changes: 54 additions & 1 deletion src/Makefile.in 100644 → 100755
Expand Up @@ -97,6 +97,7 @@ am_csmith_OBJECTS = csmith-AbsExtension.$(OBJEXT) \
csmith-LinearSequence.$(OBJEXT) csmith-MspFilters.$(OBJEXT) \
csmith-OutputMgr.$(OBJEXT) csmith-PartialExpander.$(OBJEXT) \
csmith-Probabilities.$(OBJEXT) csmith-RandomNumber.$(OBJEXT) \
csmith-Parameter.$(OBJEXT) \
csmith-RandomProgramGenerator.$(OBJEXT) \
csmith-SafeOpFlags.$(OBJEXT) csmith-Sequence.$(OBJEXT) \
csmith-SequenceFactory.$(OBJEXT) \
Expand All @@ -108,7 +109,8 @@ am_csmith_OBJECTS = csmith-AbsExtension.$(OBJEXT) \
csmith-StatementExpr.$(OBJEXT) csmith-StatementFor.$(OBJEXT) \
csmith-StatementGoto.$(OBJEXT) csmith-StatementIf.$(OBJEXT) \
csmith-StatementReturn.$(OBJEXT) csmith-StringUtils.$(OBJEXT) \
csmith-Type.$(OBJEXT) csmith-Variable.$(OBJEXT) \
csmith-Type.$(OBJEXT) csmith-PointerType.$(OBJEXT) \
csmith-AggregateType.$(OBJEXT) csmith-Variable.$(OBJEXT) \
csmith-VariableSelector.$(OBJEXT) \
csmith-VectorFilter.$(OBJEXT) csmith-platform.$(OBJEXT) \
csmith-random.$(OBJEXT) csmith-util.$(OBJEXT)
Expand Down Expand Up @@ -361,6 +363,8 @@ csmith_SOURCES = \
MspFilters.h \
OutputMgr.cpp \
OutputMgr.h \
Parameter.cpp \
Parameter.h \
PartialExpander.cpp \
PartialExpander.h \
Probabilities.cpp \
Expand Down Expand Up @@ -402,6 +406,10 @@ csmith_SOURCES = \
StringUtils.h \
Type.cpp \
Type.h \
PointerType.cpp \
PointerType.h \
AggregateType.cpp \
AggregateType.h \
Variable.cpp \
Variable.h \
VariableSelector.cpp \
Expand Down Expand Up @@ -562,6 +570,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-MspFilters.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-OutputMgr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-PartialExpander.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-Parameter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-Probabilities.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-RandomNumber.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-RandomProgramGenerator.Po@am__quote@
Expand All @@ -581,6 +590,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-StatementReturn.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-StringUtils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-Type.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-PointerType.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-AggregateType.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-Variable.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-VariableSelector.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csmith-VectorFilter.Po@am__quote@
Expand Down Expand Up @@ -1463,6 +1474,48 @@ csmith-Type.obj: Type.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-Type.obj `if test -f 'Type.cpp'; then $(CYGPATH_W) 'Type.cpp'; else $(CYGPATH_W) '$(srcdir)/Type.cpp'; fi`

csmith-Parameter.o: Parameter.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-Parameter.o -MD -MP -MF $(DEPDIR)/csmith-Parameter.Tpo -c -o csmith-Parameter.o `test -f 'Parameter.cpp' || echo '$(srcdir)/'`Parameter.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-Parameter.Tpo $(DEPDIR)/csmith-Parameter.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Parameter.cpp' object='csmith-Parameter.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-Parameter.o `test -f 'Parameter.cpp' || echo '$(srcdir)/'`Parameter.cpp

csmith-Parameter.obj: Parameter.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-Parameter.obj -MD -MP -MF $(DEPDIR)/csmith-Parameter.Tpo -c -o csmith-Parameter.obj `if test -f 'Parameter.cpp'; then $(CYGPATH_W) 'Parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter.cpp'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-Parameter.Tpo $(DEPDIR)/csmith-Parameter.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Parameter.cpp' object='csmith-Parameter.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-Parameter.obj `if test -f 'Parameter.cpp'; then $(CYGPATH_W) 'Parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter.cpp'; fi`

csmith-PointerType.o: PointerType.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-PointerType.o -MD -MP -MF $(DEPDIR)/csmith-PointerType.Tpo -c -o csmith-PointerType.o `test -f 'PointerType.cpp' || echo '$(srcdir)/'`PointerType.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-PointerType.Tpo $(DEPDIR)/csmith-PointerType.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PointerType.cpp' object='csmith-PointerType.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-PointerType.o `test -f 'PointerType.cpp' || echo '$(srcdir)/'`PointerType.cpp

csmith-PointerType.obj: PointerType.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-PointerType.obj -MD -MP -MF $(DEPDIR)/csmith-PointerType.Tpo -c -o csmith-PointerType.obj `if test -f 'PointerType.cpp'; then $(CYGPATH_W) 'PointerType.cpp'; else $(CYGPATH_W) '$(srcdir)/PointerType.cpp'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-PointerType.Tpo $(DEPDIR)/csmith-PointerType.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PointerType.cpp' object='csmith-PointerType.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-PointerType.obj `if test -f 'PointerType.cpp'; then $(CYGPATH_W) 'PointerType.cpp'; else $(CYGPATH_W) '$(srcdir)/PointerType.cpp'; fi`

csmith-AggregateType.o: AggregateType.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-AggregateType.o -MD -MP -MF $(DEPDIR)/csmith-AggregateType.Tpo -c -o csmith-AggregateType.o `test -f 'AggregateType.cpp' || echo '$(srcdir)/'`AggregateType.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-AggregateType.Tpo $(DEPDIR)/csmith-AggregateType.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AggregateType.cpp' object='csmith-AggregateType.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-AggregateType.o `test -f 'AggregateType.cpp' || echo '$(srcdir)/'`AggregateType.cpp

csmith-AggregateType.obj: AggregateType.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-AggregateType.obj -MD -MP -MF $(DEPDIR)/csmith-AggregateType.Tpo -c -o csmith-AggregateType.obj `if test -f 'AggregateType.cpp'; then $(CYGPATH_W) 'AggregateType.cpp'; else $(CYGPATH_W) '$(srcdir)/AggregateType.cpp'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-AggregateType.Tpo $(DEPDIR)/csmith-AggregateType.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AggregateType.cpp' object='csmith-AggregateType.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o csmith-AggregateType.obj `if test -f 'AggregateType.cpp'; then $(CYGPATH_W) 'AggregateType.cpp'; else $(CYGPATH_W) '$(srcdir)/AggregateType.cpp'; fi`

csmith-Variable.o: Variable.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(csmith_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT csmith-Variable.o -MD -MP -MF $(DEPDIR)/csmith-Variable.Tpo -c -o csmith-Variable.o `test -f 'Variable.cpp' || echo '$(srcdir)/'`Variable.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/csmith-Variable.Tpo $(DEPDIR)/csmith-Variable.Po
Expand Down
7 changes: 5 additions & 2 deletions src/Parameter.cpp 100644 → 100755
Expand Up @@ -3,6 +3,9 @@
// Copyright (c) 2015-2016 Xuejun Yang
// All rights reserved.
//
// Copyright (c) 2015-2016 Huawei Technologies Co., Ltd
// All rights reserved.
//
// This file is part of `csmith', a random generator of C programs.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -139,8 +142,8 @@ Parameter::GenerateParameter(Function &curFunc)
// Add this type to our parameter list.
const Type* t = 0;
bool rnd = rnd_flipcoin(40);
if (Type::has_pointer_type() && rnd) {
t= Type::choose_random_pointer_type();
if (PointerType::has_pointer_type() && rnd) {
t= PointerType::choose_random_pointer_type();
}
else {
t = Type::choose_random_nonvoid_nonvolatile();
Expand Down

0 comments on commit 37e9dd4

Please sign in to comment.