Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial fix for Issue 13761 - Fix code which triggers warnings #7557

Merged
merged 1 commit into from
Dec 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dmd/backend/cod2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ void cdnot(CodeBuilder& cdb,elem *e,regm_t *pretregs)
codelem(cdb,e->E1,&retregs,FALSE);
reg = findreg(retregs);
getregs(cdb,retregs);
cdb.gen2(0xF7 ^ (sz == 1),grex | modregrmx(3,3,reg)); // NEG reg
cdb.gen2(sz == 1 ? 0xF6 : 0xF7,grex | modregrmx(3,3,reg)); // NEG reg
code_orflag(cdb.last(),CFpsw);
if (!I16 && sz == SHORTSIZE)
code_orflag(cdb.last(),CFopsize);
Expand Down
5 changes: 2 additions & 3 deletions src/dmd/backend/cod3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2286,8 +2286,7 @@ bool cse_simple(code *c, elem *e)

void gen_testcse(CodeBuilder& cdb, unsigned sz, targ_uns i)
{
bool byte = sz == 1;
cdb.genc(0x81 ^ byte,modregrm(2,7,BPRM),
cdb.genc(sz == 1 ? 0x80 : 0x81,modregrm(2,7,BPRM),
FLcs,i, FLconst,(targ_uns) 0);
if ((I64 || I32) && sz == 2)
cdb.last()->Iflags |= CFopsize;
Expand Down Expand Up @@ -3761,7 +3760,7 @@ void prolog_loadparams(CodeBuilder& cdb, tym_t tyf, bool pushalloc, regm_t* name
}
else
{
cdb.genc1(0x8B ^ (sz == 1),
cdb.genc1(sz == 1 ? 0x8A : 0x8B,
modregxrm(2,s->Sreglsw,BPRM),FLconst,Para.size + s->Soffset);
code *c = cdb.last();
if (!I16 && sz == SHORTSIZE)
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/backend/divcoeff.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void test_udiv_coefficients()

//printf("[%d] %d %d %llx %d\n", i, shpre, mhighbit, m, shpost);
assert(shpre == ps->shpre);
assert(mhighbit == ps->highbit);
assert(mhighbit == (bool)ps->highbit);
assert(m == ps->m);
assert(shpost == ps->shpost);
}
Expand Down
4 changes: 0 additions & 4 deletions src/dmd/backend/mscoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ struct lineno
#pragma pack(1)
union auxent
{
#pragma pack(1)
// Function definitions
struct
{ unsigned TagIndex;
Expand All @@ -238,13 +237,11 @@ union auxent
// .bf symbols
struct
{
#pragma pack(1)
unsigned Unused;
unsigned short Linenumber;
char filler[6];
unsigned PointerToNextFunction;
unsigned short Zeros;
#pragma pack()
} x_bf;

// .ef symbols
Expand Down Expand Up @@ -279,7 +276,6 @@ union auxent
} x_section;

char filler[18];
#pragma pack()
};
#pragma pack()

Expand Down
3 changes: 1 addition & 2 deletions src/dmd/dcast.d
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,7 @@ extern (C++) MATCH implicitConvTo(Expression e, Type t)
Expression el = (*e.elements)[i];
if (!el)
continue;
Type te = el.type;
te = e.sd.fields[i].type.addMod(t.mod);
Type te = e.sd.fields[i].type.addMod(t.mod);
MATCH m2 = el.implicitConvTo(te);
//printf("\t%s => %s, match = %d\n", el.toChars(), te.toChars(), m2);
if (m2 < result)
Expand Down
1 change: 0 additions & 1 deletion src/dmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,6 @@ private void getenv_setargv(const(char)* envvalue, Strings* args)
p = env;
slash = 0;
instring = 0;
c = 0;
while (1)
{
c = *env++;
Expand Down
3 changes: 3 additions & 0 deletions src/dmd/root/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ nothrow:
goto err1;
}
if (!_ref)
{
.free(buffer);
buffer = null;
}
_ref = 0; // we own the buffer now
//printf("\tfile opened\n");
if (fstat(fd, &buf))
Expand Down