August 14, 2019
On Wednesday, 14 August 2019 at 08:56:27 UTC, Peter Jacobs wrote:
> Yes, there are the results of two attempts in that previous note. The second with --no-redirect.  I also checked, before running dustmite, that the script itself resulted in an exit code of 1.

Can you post the script?

If it's a shell script, enabling `set -x` at the top might give a clue.

> It is likely that I am misunderstanding something, however, it seems to me that dustmite itself is failing.

That's unlikely, but there's still many opportunities to heuristically detect classes of user mistakes and suggest actionable fixes. (E.g. this is done when the script path is specified relatively to $PWD instead of the source directory.)
August 14, 2019
On Wednesday, 14 August 2019 at 08:56:27 UTC, Peter Jacobs wrote:
> On Wednesday, 14 August 2019 at 07:13:43 UTC, Seb wrote:
>>
>> Did you follow the advice the tool gives you?
>>
>>> try using --no-redirect for details
>>
>> This means that the tester (DMD + grep) exited with a 0 exit code (i.e. no failure).
>>
>> See also: https://github.com/CyberShadow/DustMite/wiki/Reducing-a-segmentation-fault
>
> Yes, there are the results of two attempts in that previous note. The second with --no-redirect.

Ah sorry. I didn't realize this (phone screens are pretty small).

Can you post the exact command that you run?

>  I also checked, before running dustmite, that the script itself resulted in an exit code of 1.  It is likely that I am misunderstanding something, however, it seems to me that dustmite itself is failing.

BTW in my second post I mixed things up. The tester needs to exit successfully (0) (e.g grep does this iff it finds a match).
From Dustmite's documentation:

> Formulate a condition command, which should exit with a status code of 0 when DustMite is on the right track, and anything else otherwise.
August 14, 2019
On Wednesday, 14 August 2019 at 09:15:00 UTC, Vladimir Panteleev wrote:
> On Wednesday, 14 August 2019 at 08:56:27 UTC, Peter Jacobs wrote:
>> Yes, there are the results of two attempts in that previous note. The second with --no-redirect.  I also checked, before running dustmite, that the script itself resulted in an exit code of 1.
>
> Can you post the script?
>
> If it's a shell script, enabling `set -x` at the top might give a clue.
>
>> It is likely that I am misunderstanding something, however, it seems to me that dustmite itself is failing.
>
> That's unlikely, but there's still many opportunities to heuristically detect classes of user mistakes and suggest actionable fixes. (E.g. this is done when the script path is specified relatively to $PWD instead of the source directory.)

Content of dustmite-script.sh follows.

#! /bin/bash
dmd -w -O -release -inline -boundscheck=off -version=flavour_fast -dip1008 -I.. -I../nm -I../util -I../geom -I../grid_utils -I../extern/gzip -version=multi_species_gas -version=multi_T_gas -version=MHD -version=komega -ofe4shared \
	-version=tecplot_unavailable \
	main_with_rev_string.d \
	simcore.d fileutil.d json_helper.d fvcore.d fvcell.d fvvertex.d fvinterface.d fluxcalc.d onedinterp.d flowgradients.d lsqinterp.d limiters.d conservedquantities.d flowstate.d globalconfig.d globaldata.d fluidblock.d sfluidblock.d ufluidblock.d gas_solid_interface.d flowsolution.d grid_motion.d shock_fitting_moving_grid.d history.d loads.d special_block_init.d mass_diffusion.d tecplot_writer.d luaglobalconfig.d lua_helper.d luaflowsolution.d luaflowstate.d user_defined_source_terms.d postprocess.d \
	bc/package.d bc/boundary_condition.d bc/ghost_cell_effect/package.d bc/ghost_cell_effect/ghost_cell.d bc/ghost_cell_effect/internal_copy_then_reflect.d bc/ghost_cell_effect/flow_state_copy.d bc/ghost_cell_effect/flow_state_copy_from_profile.d bc/ghost_cell_effect/extrapolate_copy.d bc/ghost_cell_effect/fixed_p.d bc/ghost_cell_effect/fixed_pt.d bc/ghost_cell_effect/from_stagnation.d bc/ghost_cell_effect/full_face_copy.d bc/ghost_cell_effect/mapped_cell_copy.d bc/user_defined_effects.d bc/boundary_flux_effect.d bc/boundary_cell_effect.d bc/boundary_interface_effect.d solid/solidbc.d solid/solidblock.d solid/solid_boundary_flux_effect.d solid/solid_boundary_interface_effect.d solid/solid_loose_coupling_update.d solid/ssolidblock.d solid/solidfvcell.d solid/solidfvinterface.d solid/solidfvvertex.d solid/solidprops.d solid/solidsolution.d solid/solid_udf_source_terms.d solid/luasolidprops.d ../geom/package.d ../geom/geometry_exception.d ../geom/elements/package.d ../geom/elements/nomenclature.d ../geom/elements/vector3.d ../geom/elements/properties.d ../geom/elements/projection.d ../geom/gpath/package.d ../geom/gpath/path.d ../geom/gpath/line.d ../geom/gpath/arc.d ../geom/gpath/helix.d ../geom/gpath/bezier.d ../geom/gpath/polynomial.d ../geom/gpath/polyline.d ../geom/gpath/svgpath.d ../geom/gpath/modifiedpath.d ../geom/gpath/gpath_utils.d ../geom/surface/package.d ../geom/surface/parametricsurface.d ../geom/surface/coonspatch.d ../geom/surface/aopatch.d ../geom/surface/channelpatch.d ../geom/surface/sweptpathpatch.d ../geom/surface/meshpatch.d ../geom/surface/subrangedsurface.d ../geom/surface/bezierpatch.d ../geom/surface/beziertrianglepatch.d ../geom/volume/package.d ../geom/volume/parametricvolume.d ../geom/volume/tfivolume.d ../geom/volume/slabvolume.d ../geom/volume/wedgevolume.d ../geom/volume/sweptsurfacevolume.d ../geom/volume/twosurfacevolume.d ../geom/volume/meshvolume.d ../geom/volume/subrangedvolume.d ../geom/grid/package.d ../geom/grid/grid.d ../geom/grid/sgrid.d ../geom/grid/usgrid.d ../geom/grid/paver.d ../geom/grid/paver2d.d ../geom/misc/package.d ../geom/misc/univariatefunctions.d ../geom/misc/svg.d ../geom/misc/sketch.d ../geom/luawrap/package.d ../geom/luawrap/luaunifunction.d ../geom/luawrap/luageom.d ../geom/luawrap/luagpath.d ../geom/luawrap/luagpath_utils.d ../geom/luawrap/luasurface.d ../geom/luawrap/luavolume.d ../geom/luawrap/luagrid.d ../geom/luawrap/luasgrid.d ../geom/luawrap/luausgrid.d ../geom/luawrap/luasketch.d ../grid_utils/grid_deform.d  \
	../gas/package.d ../gas/co2gas.d ../gas/co2gas_sw.d ../gas/gas_model.d ../gas/gas_state.d ../gas/init_gas_model.d ../gas/ideal_gas.d ../gas/ideal_helium.d ../gas/cubic_gas.d ../gas/cea_gas.d ../gas/physical_constants.d ../gas/sf6virial.d ../gas/therm_perf_gas.d ../gas/very_viscous_air.d ../gas/uniform_lut.d ../gas/uniform_lut_plus_ideal.d ../gas/adaptive_lut_CEA.d ../gas/ideal_air_proxy.d ../gas/powers_aslam_gas.d ../gas/two_temperature_reacting_argon.d ../gas/ideal_dissociating_gas.d ../gas/two_temperature_air.d ../gas/two_temperature_nitrogen.d ../gas/vib_specific_nitrogen.d ../gas/fuel_air_mix.d ../gas/equilibrium_gas.d ../gas/ideal_air_fortran.o ../gas/steam.d ../gas/pseudo_species_gas.d ../gas/pseudo_species.d ../gas/electronically_specific_gas.d ../gas/electronic_species.d ../gas/two_temperature_gasgiant.d ../gas/thermo/cea_thermo_curves.d ../gas/thermo/evt_eos.d ../gas/thermo/perf_gas_mix_eos.d ../gas/thermo/pvt_eos.d ../gas/thermo/therm_perf_gas_mix_eos.d ../gas/diffusion/cea_therm_cond.d ../gas/diffusion/cea_viscosity.d ../gas/diffusion/chemkin_therm_cond.d ../gas/diffusion/chemkin_viscosity.d ../gas/diffusion/sutherland_therm_cond.d ../gas/diffusion/sutherland_viscosity.d ../gas/diffusion/therm_cond.d ../gas/diffusion/viscosity.d ../gas/diffusion/wilke_mixing_therm_cond.d ../gas/diffusion/wilke_mixing_viscosity.d ../gas/diffusion/gasgiant_transport_properties.d ../extern/gzip/gzip.d \
	../util/lua.d ../util/lua_service.d ../util/msg_service.d ../nm/package.d ../nm/number.d ../nm/complex.d ../nm/bbla.d ../nm/bdfLU.d ../nm/bracketing.d ../nm/brent.d ../nm/gaussquad.d ../nm/linesearch.d ../nm/nelmin.d ../nm/newtoncotes.d ../nm/ridder.d ../nm/rungekutta.d ../nm/rsla.d ../nm/smla.d ../nm/tree_patch.d ../nm/univariate_lut.d \
	../kinetics/package.d ../kinetics/thermochemical_reactor.d ../kinetics/init_thermochemical_reactor.d ../kinetics/chemistry_update.d ../kinetics/electronic_update.d ../kinetics/electronically_specific_kinetics.d ../kinetics/ideal_dissociating_gas_kinetics.d ../kinetics/fuel_air_mix_kinetics.d ../kinetics/powers_aslam_kinetics.d ../kinetics/rate_constant.d ../kinetics/reaction.d ../kinetics/reaction_mechanism.d ../kinetics/two_temperature_air_kinetics.d ../kinetics/two_temperature_argon_kinetics.d ../kinetics/two_temperature_nitrogen_kinetics.d ../kinetics/vib_specific_nitrogen_kinetics.d ../kinetics/two_temperature_gasgiant_kinetics.d ../gas/luagas_model.d ../kinetics/luathermochemical_reactor.d ../kinetics/luachemistry_update.d ../kinetics/luaelectronically_specific_kinetics.d ../kinetics/luareaction_mechanism.d ../kinetics/luatwo_temperature_air_kinetics.d ../kinetics/luavib_specific_nitrogen_kinetics.d \
	../gasdyn/gasflowexception.d ../gasdyn/idealgasflow.d ../gasdyn/luaidealgasflow.d ../gasdyn/gasflow.d ../gasdyn/luagasflow.d ../nm/luabbla.d  \
	-L-L../../extern/lua-5.1.4/lib  -L-llua -L-ldl 2>&1 | grep -qF "tym = 14"

August 14, 2019
On Wednesday, 14 August 2019 at 09:20:58 UTC, Peter Jacobs wrote:
> Content of dustmite-script.sh follows.

Looks fine; make sure you get an exit code of 0 though as per Seb's post.

If you don't, remove the grep from the end and check the compiler output, as it probably isn't what you were expecting.

August 14, 2019
On Wednesday, 14 August 2019 at 09:26:58 UTC, Vladimir Panteleev wrote:
> On Wednesday, 14 August 2019 at 09:20:58 UTC, Peter Jacobs wrote:
>> Content of dustmite-script.sh follows.
>
> Looks fine; make sure you get an exit code of 0 though as per Seb's post.
>
> If you don't, remove the grep from the end and check the compiler output, as it probably isn't what you were expecting.

I definitely have been thinking incorrectly about the exit code.  Now that I reread the dustmite output with that in mind, it makes better sense, although it seems a bit of a "hard stop" to dustmite's execution.

I will fix the exit code for the script and try again.



August 14, 2019
On Wednesday, 14 August 2019 at 09:48:09 UTC, Peter Jacobs wrote:
>
> I will fix the exit code for the script and try again.

There were a couple of issues.  I could not match the string, even when I corrected its text (to include the 'x').  All of my attempts at redirection of the string seemed to have been unsuccessful, maybe because of the Illegal Instruction associated with the dmd command.

Anyway, I changed to detecting exit code 132 for the Illegal Instruction and redirecting stdout and stderr in the bash script before invoking the dmd command.  Now dustmite is doing its thing.  I will leave it over night to see what gets reduced.

Thanks, all, for the tutoring.

August 14, 2019
On Wednesday, 14 August 2019 at 11:56:51 UTC, Peter Jacobs wrote:
> On Wednesday, 14 August 2019 at 09:48:09 UTC, Peter Jacobs wrote:
>>
>> I will fix the exit code for the script and try again.
>
> There were a couple of issues.  I could not match the string, even when I corrected its text (to include the 'x').  All of my attempts at redirection of the string seemed to have been unsuccessful, maybe because of the Illegal Instruction associated with the dmd command.

FYI, the reason why you can't grep for "Illegal Instruction" (or "Segmentation fault" or other such error messages), is because that is printed by the shell running your test shell script, i.e. it happens "above" the grep command. (Specifically it prints this message as a result of the process being killed by SIGILL / SIGSEGV etc.)

August 14, 2019
On Wednesday, 14 August 2019 at 12:05:43 UTC, Vladimir Panteleev wrote:
>
> FYI, the reason why you can't grep for "Illegal Instruction" (or "Segmentation fault" or other such error messages), is because that is printed by the shell running your test shell script, i.e. it happens "above" the grep command. (Specifically it prints this message as a result of the process being killed by SIGILL / SIGSEGV etc.)

Not quite the issue. I was trying (unsuccessfully) to grep for "tym = x14", as suggested by Seb.  That should have been sent through to grep but it seems not.  The compiler should not be trying to execute an illegal instruction, anyway, so that seems to be a good target for dustmite's experiments.

While dustmite is currently chipping away, and given the correct link by Matheus, I am watching your 2014 DConf presentation.  Excellent work!

Cheers,
Peter J.





August 14, 2019
On Wednesday, 14 August 2019 at 12:47:37 UTC, Peter Jacobs wrote:
>
> [..]
> The compiler should not be trying to execute an illegal instruction, anyway, so that seems to be a good target for dustmite's experiments.
> [..]

What actually happens is that the compiler has reached an assert(0) statement which on x86 is implemented as UD2 or HLT instruction as a efficient way to signal that an unreachable part of the program has been reached (likely as a result of an unhandled case).

August 19, 2019
On Monday, 12 August 2019 at 11:30:58 UTC, Nicholas Wilson wrote:
[...]
>
> So it would appear that you are trying (apparently successfully with debug DMD (and LDC(?)) to use `real` with xmm somehow???
> I can't really help anymore without a reduced test case.

Nicholas,
That rabbit hole was about 5 days deep :)

Here is the test case, now that dustmite has done its work:

// test2.d PJ 2019-08-19
import std;
double r2_r1_obl(double , double beta, double )
{
    double M1n = fabs(sin(beta));
    return M1n;
}
double V2_V1_obl(double M1, double beta, double g)
{
    return sin(beta) / r2_r1_obl(M1, beta, g);
}

my build script:

#! /bin/bash
dmd -O -inline test2.d

and a log of the result:

peterj@helmholtz ~/dgd-play/src/test $ ./build-test2.sh
tym = x14
./build-test2.sh: line 2:  3723 Illegal instruction     (core dumped) dmd -O -inline test2.d
peterj@helmholtz ~/dgd-play/src/test $ dmd --version
DMD64 D Compiler v2.087.1
Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright